Area and circumference of a Circle using C programming
Q. Write a C program to find area and circumference of a circle.
Ans:
#include <stdio.h>
#define PI 3.14159
int main() {
float radius, area, circumference;
printf("Enter the radius of the circle: ");
scanf("%f", &radius);
// Calculate area and circumference using formulas
area = PI * radius * radius;
circumference = 2 * PI * radius;
printf("Area of the circle is: %.2f\n", area);
printf("Circumference of the circle is: %.2f\n", circumference);
return 0;
}
Comments
Post a Comment