Saturday, 5 September 2020

Program to calculate circumference of the circle

  /*Program to find circumference of the circle*/

#include <stdio.h>

#define PI 3.14

int main()

{

float r,circumference;

printf("Enter the radius of the circle:");

scanf("%f",&r);

circumference=2*PI*r;

printf("The circumference of the circle is %.2f",circumference);

return 0;

}

OUTPUT

Enter the radius of the circle: 2.7

The circumference of the circle is 16.96

Description:

Here we ask the user to give the radius of the circle and the value of PI is defined by define function.

No comments:

Post a Comment

If you have any doubt, please ask in the comment section.

Search This Blog

Program to print weather the number is happy or not.

#include <stdio.h> #include <math.h> int main () { int i , j , num , temp , sum = 0 ; printf ( "Enter number\n...