In this C program, we will find the circumference and area of circle when radius is given. To find the circumference and area of circle, we will first take radius of circle as input from user using scanf function and then calculate area and perimeter of circle using following formulae.
Required Knowledge
- Circumference of Circle = 2 x PI x Radius
- Area of Circle = PI X Radius X Radius
C program to find the circumference and area of circle
#include <stdio.h> #define PI 3.141 int main() { float radius; float circumference, area; printf("Enter Radius of Circle\n"); scanf("%f", &radius); circumference = 2*PI*radius; area = PI*(radius*radius); printf("Circumference of Circle : %.4f\n", circumference); printf("Area of Circle = %.4f\n", area); return 0; }
Output
Enter Radius of Circle 4.2 Circumference of Circle : 26.3844 Area of Circle = 55.4072
Related Topics