Write a c program to calculates the area (floating point number with two decimal places) of a circle given it's radius (integer value). The value of pi is 3.14.
Answers
Answered by
3
Answer:#include <stdio.h>
int main() {
float radius, area_circle;
// take radius as input
printf("Enter the radius of circle : ");
scanf("%f", &radius);
area_circle = 3.14 * radius * radius;
printf("Area of circle : %f", area_circle);
return 0;
}
Output
Enter the radius of circle : 10.0
Area of circle : 314
Explanation:
Answered by
7
Answer:
#include <stdio.h>
#include <math.h>
#define PI 3.14
Int main()
{
Int radius;
float area;
printf("Enter the radius of a circle \n");
scanf("%f", &radius);
area = PI * pow(radius, 2);
printf("Area of a circle = %5.2f\n", area);
}
Explanation:
The PI value is already given so we use #define PI 3.14
And because we use some mathematics calculation we used #include<math.h>
Hader file
Similar questions