1. 程式人生 > >作業: 1.8(圓的面積和周長)編寫程序,使用以下的公式計算並顯示半徑為5.5的圓的面積和周長。

作業: 1.8(圓的面積和周長)編寫程序,使用以下的公式計算並顯示半徑為5.5的圓的面積和周長。

http string oid ren png ble -1 args 技術

public class Demo_1

{
public static void main(String[] args)

{

double radius,C;
double area;
radius=5.5;
area=radius*radius*Math.PI;
C=radius*2*3.14150;
System.out.println("the area for the circle of radius " + radius + " is " + area);
System.out.println("the circumference for the circle of radius " + radius + " is "+ area);
}
}

技術分享

作業: 1.8(圓的面積和周長)編寫程序,使用以下的公式計算並顯示半徑為5.5的圓的面積和周長。