fork download
  1. #include <stdio.h>
  2. #define PI 3.14159265358979323846
  3.  
  4. double delta_cone(double r, double h) {
  5. return (1.0 / 3.0) * PI * r * r * h;
  6. }
  7.  
  8. int main() {
  9. double radius, height;
  10.  
  11. printf("円の半径 r : ");
  12. scanf("%lf", &radius);
  13. printf("円錐の高さ h: ");
  14. scanf("%lf", &height);
  15.  
  16. double volume = delta_cone(radius, height);
  17.  
  18. printf("円錐の体積V: %.2f\n", volume);
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
円の半径 r : 円錐の高さ h: 円錐の体積V: 0.00