作业: 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);
    }
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM