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
",s=2.0*s1+s2);} 
11     return 0; 
12 } 
原文地址:https://www.cnblogs.com/dddddd/p/6675904.html