How to write a programme in c to calculate the area of circle? |
[Edit] |
Answer
We can use any method. As we can find out the area of the circle by three methods as i known.
1.ordinary programming
e.g.
void main()
{
int r;float area;
printf("\n\tEnter radius of the circle : ");
scanf("%d",&r);
area=3.14*r*r;
printf("Radius = %d and area=%f",r,area);
}
2. By using macros
e.g. #define PI 3.14
#define AREA(x) PI*x*x
3. We can solve by user defined functions also
First answer by Janugiraman. Last edit by Janugiraman. Contributor trust: 26 [recommend contributor]. Question popularity: 10 [recommend question]
|
Research your answer: |



