圆的面积和周长
编写程序 使用以下公式计算并显示半径为5.5的圆的面积和周长:
周长 = 2* 半径* Π
面积 = 半径* 半径* Π
public class Circle {
public static void main(String[] args) {
double r = 5.5;
double circumference = 2*r*Math.PI;
double area = r*r*Math.PI;
System.out.println("circumference = " + circumference);
System.out.println("area = " + area);
}
}