program to accept radius of circle and find area and circumference
program to accept radius of a circle and find area and circumference
here we c4fun is coming up with a simple program that will help you to calculate area & circumference of a circle, by the radius which you provide as an input.the formula can be made :
Area =3.14*radius*radius
circumference=2*3.14*radius
to find out the area and circumference we must input the radius .the program will ask a user to enter the radius and based on it the result will be displayed.
to make it simple 3.14 value of pi has bed used in place of 22/7.
#include<stdio.h>
#include<conio.h>
void main()
{
int r;
float ac ,cc;
clrscr();
printf("enter radius of circle\n");
scanf("%d",&r);
ac=3.14*r*r;
cc=2*3.14*r;
printf("\narea=%f\tcircumference=%f",ac,cc);
getch();
}
output
enter radius of a circle
2
area=12.000 circumference=12.0000
if you want the result to be more accurate then you can use 22/7 in place of 3.14.
comment the different results you get after entering the different values!!
Leave a Comment