You are currently viewing WAP to Calculate the area of a circle

WAP to Calculate the area of a circle

  • Post category:C Programs
Share this to everyone:
#include <stdio.h>

#define PI 3.14159

int main() {
    float radius, area;

    // Prompt the user to enter the radius of the circle
    printf("Enter the radius of the circle: ");
    scanf("%f", &radius);

    // Calculate the area
    area = PI * radius * radius;

    // Print the result
    printf("The area of the circle is: %.2f\n", area);

    return 0;
}

Leave a Reply