Circumference of Circle in C
Q. Write a C program to find the area and circumference of a circle.
#include <stdio.h>
#include <conio.h>
void main() {
float r, a, c;
clrscr();
printf("Enter the radius of circle: ");
scanf("%f", &r);
a =3.14 *r *r;
printf("Area of circle : %.2f\n", a);
c=2*3.14*r;
printf("circumference of circle : %.2f", c);
getch();
}
Q. Write an algorithm to find the area and circumference of a circle.
1. Start 2. Declare variables: - `r` (float) for radius - `a` (float) for area - `c` (float) for circumference 3. Prompt user to enter the radius of the circle 4. Read the input value for radius `r` 5. Calculate the area: \( a = \pi \times r \times r \) (Use \(\pi = 3.14\)) 6. Calculate the circumference: \( c = 2 \times \pi \times r \) (Use \(\pi = 3.14\)) 7. Display the area with two decimal places 8. Display the circumference with two decimal places 9. End
Quickly Find What You Are Looking For
OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.
point.com