Untitled

 avatar
unknown
plain_text
24 days ago
680 B
1
Indexable
#include <stdio.h>
#define PI 3.14159

int main() {
    float radius, diameter, circumference, surfaceArea, volume;

    // Ask the user for the radius
    printf("Enter the radius: ");
    scanf("%f", &radius);

    // Calculate properties
    diameter = 2 * radius;
    circumference = 2 * PI * radius;
    surfaceArea = 4 * PI * radius * radius;
    volume = (4.0 / 3.0) * PI * radius * radius * radius;

    // Display the results
    printf("\nCircle:\n");
    printf("Diameter: %f\n", diameter);
    printf("Circumference: %f\n", circumference);

    printf("\nSphere:\n");
    printf("Surface Area: %f\n", surfaceArea);
    printf("Volume: %f\n", volume);

    return 0;
}
Leave a Comment