Guest User

Untitled

a guest
Feb 16th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main()
  4.  
  5. {
  6.  
  7. float h,r,c,s,sq,vq,vz;
  8.  
  9. float pi = 3.1415265358979;
  10.  
  11. printf("請輸入圓圓半徑r,圓圓柱高h:\n");
  12.  
  13. scanf("%f,%f",&r,&h);
  14.  
  15. c = 2 * pi*r;
  16.  
  17. s = pi*r*r;
  18.  
  19. sq = 4 * pi*r*r;
  20.  
  21. vq = (4 / 3)*pi*r*r*r;
  22.  
  23. vz = pi*r*r*h;
  24.  
  25. printf("圓周長為:c=%4.2f\n",c);
  26.  
  27. printf("圓面積為:s=%5.2f\n",s);
  28.  
  29. printf("圓球表面積:sq=%5.2f\n", sq);
  30.  
  31. printf("圓球體積為:vq=%5.2f\n", vq);
  32.  
  33. printf("圓柱體積為:vz=%5.2f\n", vz);
  34.  
  35. system("read -n1 -p \"press key to contiune\"");
  36.  
  37. return 0;
  38. }
Add Comment
Please, Sign In to add comment