fork download
  1. #include <stdio.h>
  2. #define PI 3.14159265
  3.  
  4. int main(int argc, const char * argv[])
  5. {
  6.  
  7. // insert code here...
  8. // printf("Hello, World!\n");
  9.  
  10. float radius, diameter, area, circumference;
  11.  
  12. printf("\n Enter the diameter of the circle\n");
  13. scanf("%f",&diameter);
  14.  
  15. radius=diameter/2.0;
  16.  
  17. circumference= 2.0*PI*radius;
  18. area=PI*(radius)*(radius);
  19.  
  20. printf("\n The area of the circle is: %.2f\n", area);
  21. printf("\n The circumference of the circle is: %.2f\n", circumference);
  22.  
  23.  
  24.  
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0s 2296KB
stdin
6
stdout
 Enter the diameter of the circle

 The area of the circle is: 28.27

 The circumference of the circle is: 18.85