Source Code:
/*to find the area and circumference of a circle*/
#include<stdio.h>
#include<math.h>
int main()
{
float r, a, c;
printf("Enter the value of radius: ");
scanf("%f", &r);
a = M_PI * r * r;
c = 2 * M_PI * r;
printf("Area of circle = %f", a);
printf("\nCircumference of the circle = %f", c);
return 0;
}
Sample run:
Enter the value of radius: 5
Area of circle = 78.539818
Circumference of the circle = 31.415926
No comments:
Post a Comment