C Program to Find Area of a Circle.

In this C program, we are going to find the area of a circle for which the radius is given. The area of a circle is the measure of the region enclosed by the circle. 

Area of Circle Formula:
Area (A) = π * radius^2

Example: 
Input: r = 5
Output: 78.5 sq units

Explanation: 
Area = 3.14 * 5 * 5
     = 3.14 * 25
     = 78.5 square units

Step-by-step Algorithm:

Step 1: Input the radius (r) of the circle from the user.
Step 2: Calculate the area (A) of the circle using the formula: A = π * r^2.
Step 3: Display the calculated area of the circle.

C program to Print Aread of a Circle.

//C implementation to find Area of a circle
#include <stdio.h>
#define PI 3.14

int main() {
    float radius, area;

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

    // area of the circle
    area = PI * radius * radius;

    printf("Area of the circle: %.2f square units\n", area);

    return 0;
}
Output:
Enter the radius of the circle: 5
Area of the circle: 78.50 square units

⚡ Please share your valuable feedback and suggestion in the comment section below or you can send us an email on our offical email id ✉ algolesson@gmail.com. You can also support our work by buying a cup of coffee ☕ for us.

Similar Posts

No comments:

Post a Comment


CLOSE ADS
CLOSE ADS