7-3 输入半径计算圆的面积
分数 20
全屏浏览
切换布局
作者 殷伟凤
单位 浙江传媒学院
从控制台输入半径,计算圆的半径。其中PI=3.14159
输入格式:
输入圆的半径
输出格式:
输出一行面积信息
输入样例:
10
输出样例:
The area for the circle of radius 10.0 is 314.159
代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB
栈限制
8192 KB
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
double r = in.nextDouble();
double PI = 3.14159;
System.out.println("The area for the circle of radius"+" "+r+" "+"is"+" "+r*r*PI);
}
}
欢迎交流学习,欢迎评论区留言