Write a c program to find the area of circle Using Functions
byNEED WORK PRODUCE WORK-
0
TASK-
Write a c program to find the area of circle with formula as below
Area of the Circle = πr2
In which declare π as a global variable, and make a function of area_of_cirlce and pass the
value of r to the function and print.
CODE:
#include<stdio.h> void area_of_circle(float r);
float p=3.14; //value of pie is declared as globle variable
int main(){ float rad;
printf("Enter the radius of circle: "); scanf("%f",&rad);
area_of_circle(rad); //calling the function
getchar(); return 0; }
void area_of_circle(float r) { float area; area=(p)*r*r; //Formula of area of circle printf("\n\n The area_of_circle with %0.2f radius is %0.2f",r,area); }