作业: 1.8(圆的面积和周长)编写程序,使用以下的公式计算并显示半径为5.5的圆的面积和周长。

Posted mawenqi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了作业: 1.8(圆的面积和周长)编写程序,使用以下的公式计算并显示半径为5.5的圆的面积和周长。相关的知识,希望对你有一定的参考价值。

/**
 *  需求:计算出圆的面积,周长
 *  思路:利用公式,调用Math.PI
 *   
 *  步骤:略
 */
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的圆的面积和周长。的主要内容,如果未能解决你的问题,请参考以下文章

用java求圆的面积与周长

编写程序,解析在命令行输入的圆的半径,计算圆的周长和面积(结果保留两位小数)?

python编写圆的面积的程序

第四次作业-计算圆的周长和面积

第四次作业-计算圆的周长和面积

用Java编写程序,从键盘输入圆的半径,求圆的周长和面积并输出