A Program to Find the Area of a Circle

In this example, we are giving a program to find the area of a circle. The rule of finding the area of a circle is: A = πr2.


Program to find the area of a circle:

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4. int main() {
  5. float pie, r, area;
  6. pie = 3.14;
  7. printf("Enter the value of radius: ");
  8. scanf("%f",&r);
  9. area = 3.14 * pow(r,2);
  10. printf("Area of circle: %.2f", area);
  11. return 0;
  12. }

Output:

Enter the value of radius: 3
Area of circle: 28.26