C Program for Circumference of a Circle

The Circumference of a Circle can be calculated using the formulae 2*PI*r

In the below c program, the PI value taken as 3.14.

All the values dealing with Decimals, so float is a Datatype. 

int is not a right datatype, it will remove all the decimal parts of output.

include

int main ()
{

float radius, circumference;

printf (” Enter the Radius of Circle:”);

scanf (“%f”, &radius);

circumference = 2 * 3.14 * radius;

printf (“\nThe Circumference of a Circle is %f”, circumference);

return 0;

}

Output for Circumference of a Circle:

Enter the Radius of Circle:8

The Circumference of a Circle is 50.240002

Leave a Reply

Your email address will not be published.