Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
611 B
2
Indexable
Never
#include <stdio.h>
#include <math.h>

int main() {
    double radius, diameter, circumference, area;

    // Input the radius from the user
    printf("Enter the radius of the circle: ");
    scanf("%lf", &radius);

    // Calculate the diameter, circumference, and area
    diameter = 2 * radius;
    circumference = 2 * M_PI * radius;
    area = M_PI * pow(radius, 2);

    // Display the results
    printf("Diameter of the circle: %.2lf\n", diameter);
    printf("Circumference of the circle: %.2lf\n", circumference);
    printf("Area of the circle: %.2lf\n", area);

    return 0;
}