Write a program that reads the radius of a circle and calculates the area and circumference then prints the results.
#include <stdio.h>
#define PI 3.1415926
int main() {
double r, area, circum;
printf("Enter the radius of the circle: ");
scanf("%lf", &r);
area = PI * r * r;
circum = 2 * PI * r;
printf("The area of the circle is %.3lf\n", area);
printf("The circumference of the circle is %.3lf\n", circum);
return 0;
}
Comments
Leave a comment