Programming

C- Read Radius of Circle, Calculate Area and Circumference

Write a c program to read radius of a circle and calculate area and circumference. The value of PI : 3.14159

C Code

#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
float r, a, c;

printf("nEnter radius of a circle:");
scanf("%f",&r);

a = M_PI*r*r;
c = 2*M_PI*r;

printf("nArea of cicle = %f",a);
printf("nCircumference of circle = %f",c);

getch();
}

Output

Tuts

About Author

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.