任务描述:
已知半径r,求一个圆的面积(保留两位小数),其中 0 < r < 5,PI = 3.14,圆面积公式: PI * r * r
任务要求:

代码示例:
java
package April_2024;
import java.util.Scanner;
// 已知半径r,求一个圆的面积(保留两位小数)
// 其中 0 < r < 5,PI = 3.14
// 圆面积公式: PI * r * r
public class a240417_1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("输入一个半径,浮点类型: ");
double r = sc.nextDouble();
if (r > 0 && r < 5){
double area = 3.14 * r * r;
System.out.printf("圆的面积: %.2f", area);
} else {
System.out.println("输入的半径不在范围内(0 < r < 5)");
}
}
}
