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; }
Enter the radius of the circle: 5
Area of the circle: 78.50 square units
No comments:
Post a Comment