Answer to Question #308218 in C for ahmed

Question #308218

Write a program that reads the radius of a circle and calculates the area and circumference then prints the results.


1
Expert's answer
2022-03-10T10:19:18-0500
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS