Area of Circle Program in C
C
// C program to find the area of // the circle using radius #include <math.h> #include <stdio.h> #define PI 3.142 // Function to find the area of // of the circle double findArea( int r) { return PI * r * r; } // Driver code int main() { printf ( "Area is %f" , findArea(5)); return 0; } |
Output
Area is 78.550000
Complexity Analysis
Time Complexity: O(1)
Auxiliary Space: O(1)
Please refer complete article on Program to find the area of a circle for more details.
C Program to Find Area of Circle
The area of a circle is the region enclosed by the circle’s boundary. In this article, we will learn the program to find the area of a circle in C programming.
The area of a circle can simply be evaluated using the formula:
Area = Pi * r2
where r is the radius of the circle and the value of Pi is 3.14159265358.
Algorithm to Find Area of Circle in C
- Define a constant PI with the value of 3.142.
- Create a function findArea.
- Within the findArea function, Multiply PI by the square of the radius r and return the result.