Problem Statement
Given a radius ‘r’, your job is to find the area of a circle in C programming language.
Code
#include<stdio.h>
#define pi 3.14
float area(float r)
{
float ar=pi*r*r;
return ar;
}
int main()
{
float r;
printf("Enter the radius : ");
scanf("%f",&r);
float res=area(r);
printf("%f",res);
return 0;
}
Output
Enter the radius : 5
78.500000
Explanation
Area of circle : pi * r * r.