1103: 零起點學算法10——求圓柱體的表面積


1103: 零起點學算法10——求圓柱體的表面積

Time Limit: 1 Sec  Memory Limit: 128 MB   64bit IO Format: %lld
Submitted: 11616  Accepted: 1956
[Submit][Status][Web Board]

Description

很簡單的問題,求圓柱體的表面積

 

Input

多組測試數據,每組輸入底面半徑r和高h

 

Output

每組輸出圓柱體的表面積,保留3位小數

 

Sample Input

 
3.5 9

 

Sample Output

Area=274.889

 

HINT

 

注意:pi的計算為:const double pi=4.0 * atan(1.0);

 

Source

 
 1 #include<stdio.h> 
 2 #include<math.h> 
 3 const double pi=4.0 * atan(1.0); 
 4 int main () 
 5 { 
 6     double r,h,s1,s2,s; 
 7     while(scanf("%lf%lf", &r , &h)!=EOF) 
 8     {s1=pi*r*r; 
 9     s2=2*pi*r*h; 
10     printf("Area=%.3lf\n",s=2.0*s1+s2);} 
11     return 0; 
12 } 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM