To find area of a circle
Topics Covered:
- Some examples of data type
- To find area of a circle
- To find area of a room
- To find volume of room
- To find simple interest
//some examples of data type
#include<conio.h>
#include<stdio.h>
int main()
{
char name[30]=”kedarbhandari”,g=’m’,a=’18’;
float h=5.3, w=52;
printf(“name=%s\n”, name);
printf(“gender=%c\n”,g);
printf(“height=%.2f\n”,h);
printf(“weight=%.2f\n”,w);
printf(“age=%d”,a);
return 0;
}
//to find area of a circle
#include<conio.h>
#include<stdio.h>
int main()
{
float a,r,pi=3.14;
printf(“enter the value of radius”);
scanf(“%f”,&r);
a=pi*r*r;
printf(“area of a circle=%.2f”,a);
return 0;
}
//to find area of a room
#include<conio.h>
#include<stdio.h>
int main()
{
int a,l,b;
printf(“enter the value of l and b\n”);
scanf(“%d%d”,&l,&b);
a=l*b;
printf(“area of a room=%d”,a);
return 0;
}
//to find volume of a room
#include<stdio.h>
#include<conio.h>
void main()
{
float v,l,b,h;
printf(“enter the value of length”);
scanf(“%f”,&l);
printf(“enter breadth”);
scanf(“%f”,&b);
printf(“enter height”);
scanf(“%f”,&h);
v=l*b*h;
printf(“volume of a room=%.2f”,v);
return 0;
}
//to find simple interest
#include<conio.h>
#include<stdio.h>
int main()
{
float p,t,r,si;
printf(“enter the value of principle,time and rate\n”);
scanf(“%f%f%f”,&p,&t,&r);
si=(p*t*r)/100;
printf(“the value of simple interest=%.2f”,si);
return 0;
}