C Program To Find Circumference Of Circle

Ex: Write a C program to find circumference of circle. How to write a C program to find circumference of circle. C program to find circumference of circle.


Input from user:
Enter the number: 9

Expected output:
Circumference of circle is 56.520000




Step by step logic of the given program:

1. Accept input from user declare variable say no.

2. To find circumference of circle use following circumference formula:
2πr.

3. But in logic of the program we need to add pi's value means 3.14.

4. We will find circumference of circle as follows:
c=2*3.14*r;

5. Print value of c (circumference of circleon the output screen.





Program:


#include<stdio.h>
void main()
{
int r;
float c;

printf("enter the radius of circle\n");
scanf("%d",&r);

c=2*3.14*r;

printf("circumference of circle is %f",c);

}



Above two Program's show's the following output:

C Program To Find Circumference Of  Circle


No comments:

Post a Comment

If you have any doubts, please discuss here...👇