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.
Area of Circle Program in C
C
#include <math.h>
#include <stdio.h>
#define PI 3.142
double findArea( int r) { return PI * r * r; }
int main()
{
printf ( "Area is %f" , findArea(5));
return 0;
}
|
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.
Last Updated :
14 Jul, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...