This blog is under construction

Saturday 22 June 2013

C program to find the area and circumference of a circle

Write a C program to find the area and circumference of a circle.


  #include <stdio.h>
  int main() {
        float area, circumference, radius;
        printf("Enter the radius of the circle:");
        scanf("%f", &radius);
        area = 3.14 * radius * radius;
        circumference = 2 * 3.14 * radius;
        printf("Area: %f\n", area);
        printf("Circumference: %f\n", circumference);
        return 0;
  }



  Output:
  jp@jp-VirtualBox:~/$ ./a.out
  Enter the radius of the circle:100
  Area: 31400.000000
  Circumference: 628.000000





See Also:

No comments:

Post a Comment