C Program To Find Area of Circle
In this article, we are going to write a c program to find area of circle.
We will make this program in the following way -:
- C Program To Find Area of Circle (Simple Way)
- C Program To Find Area of Circle Using Function
- C Program To Find Area of Circle Using Pointer
- C Program To Find Area of Circle Using Mirco or #define
To make this program, we will use the following concept given below.
If you do not know about these topics well, then you may not understand this program, so you should know about them in detail from the link given above.
Now without wasting time let’s start programming.
C Program To Find Area of Circle (Simple Way)
Algorithm
- Program Start
- Declare Variables
- Input Radius From User
- Calculate the Area of the Circle
- Display Result
- Program End
Program
#include<stdio.h>
void main()
{
float r,aoc;
printf("Enter the radius : ");
scanf("%f",&r);
aoc=3.14*(r*r);
printf("area of circle is : %f",aoc);
}
Output
Enter the radius : 5
area of circle is : 78.500000
C Program To Find Area of Circle Using Function
Algorithm
- Program Start
- Declare Variables
- Input Radius From User
- Calling Function To Calculate Area of Circle
- Calculating Area of Circle
- Display Result
- Program End
Program
#include<stdio.h>
void areaofCircle(float r)
{
float aoc;
aoc=3.14*(r*r);
printf("area of circle is : %f",aoc);
}
void main()
{
float r;
printf("Enter the radius : ");
scanf("%f",&r);
areaofCircle(r);
}
Output
Enter the radius : 7
area of circle is : 153.860001
C Program To Find Area of Circle Using Pointer
Program
#include<stdio.h>
void areaofCircle(float *r, float *aoc)
{
*aoc=((3.14)*(*r)*(*r));
}
void main()
{
float r, aoc;
printf("Enter the radius : ");
scanf("%f",&r);
areaofCircle(&r,&aoc);
printf("area of circle is : %f",aoc);
}
Output
Enter the radius : 3
area of circle is : 28.260000
C Program To Find Area of Circle Using Micro or #Define
Program
//C Program To Find Area of Circle Using Micro or #Define
#include<stdio.h>
#define pi 3.14
void areaofCircle(float r)
{
float aoc;
aoc=pi*(r*r);
printf("area of circle is : %f",aoc);
}
void main()
{
float r;
printf("Enter the radius : ");
scanf("%f",&r);
areaofCircle(r);
}
Output
Enter the radius : 10
area of circle is : 314.000000
Read More
- Download C Language Notes Pdf
- C Language Tutorial For Beginners
- C Programming Examples With Output
- 250+ C Programs for Practice PDF Free Download
Conclusion
So friends, in this article, we have written a c program to find area of circle In this ways -:
- C Program To Find Area of Circle (Simple Way)
- C Program To Find Area of Circle Using Function
- C Program To Find Area of Circle Using Pointer
- C Program To Find Area of Circle Using Mirco or #define
If you have difficulty to understand any program or have any doubts or questions, then tell me in the comment below.