Problem Description
已知圆柱体的底面半径r和高h,计算圆柱体底面周长和面积、圆柱体侧面积以及圆柱体体积。其中圆周率定义为3.1415926。
Input
输入数据有一行,包括2个正实数r和h,以空格分隔。
Output
输出数据一行,包括圆柱体底面周长和面积、圆柱体侧面积以及圆柱体体积,以空格分开,所有数据均保留2位小数。
Sample Input
1 2
Sample Output
6.28 3.14 12.57 6.28
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
int r, h;
double PI = 3.1415926;
double a, b, c, d;
r = reader.nextInt();
h = reader.nextInt();
a = 2*PI*r;
b = PI*r*r;
c = a*h;
d = b*h;
System.out.printf("%.2f %.2f %.2f %.2f\n", a, b, c, d);
}
}