programming-examples/c/Functions/C Program to Calculate the Area of a Circle.c

15 lines
328 B
C
Raw Normal View History

2019-11-15 12:59:38 +01:00
/*
* C program to find the area of a circle, given the radius
*/
#include <stdio.h>
#include <math.h>
#define PI 3.142
void main()
{
float radius, area;
printf("Enter the radius of a circle \n");
scanf("%f", &radius);
area = PI * pow(radius, 2);
printf("Area of a circle = %5.2f\n", area);
}