Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming in C.

Similar presentations


Presentation on theme: "Programming in C."— Presentation transcript:

1 Programming in C

2 #include <stdio.h> #include <conio.h>
Program to find an area and circumference of an area #include <stdio.h> #include <conio.h> #include <math.h> int main() {int r; float pi=3.14, area,ci; printf("enter radius:"); scanf("%d", &r); //area=pi*r*r; area=pi*(pow(r,2)); printf("area of circle =%f \n ", area); ci=2*pi*r; printf(" circumference =%f",ci); getch(); }

3 scanf("%d%d%d",&p,&r,&t); si=(p*r*t)/100;
Program to find the simple interest int p,r,t,si; printf("eneter principle, rate of interest & time to find simple interest: \n"); scanf("%d%d%d",&p,&r,&t); si=(p*r*t)/100; printf("simple interest=%d",si); getch();

4 printf("enter marks of 5 subjects:");
Program to calculate sum of 5 subjects and find percentage int s1,s2,s3,s4,s5,sum,total=500; float per; printf("enter marks of 5 subjects:"); scanf("%d%d%d%d%d",&s1,&s2,&s3,&s4,&s5); sum=s1+s2+s3+s4+s5; printf("sum=%d \n",sum); per=(sum*100)/total; printf("percentage =%f",per);

5 printf("eneter value of a&b: \n"); scanf("%d%d",&a,&b); a=a+b; b=a-b;
Program to swap two numbers without using a third variable int a,b; printf("eneter value of a&b: \n"); scanf("%d%d",&a,&b); a=a+b; b=a-b; a=a-b; printf("after swapping the value of a&b:%d\n%d",a,b);


Download ppt "Programming in C."

Similar presentations


Ads by Google