码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-09-24 09:49:45      阅读:963      评论:0      收藏:0      [点我收藏+]

标签:logs   for   demo   圆周率   enc   步骤   system   void   str   

/**
 *  需求:计算出圆的面积,周长
 *  思路:利用公式,调用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的圆的面积和周长。

标签:logs   for   demo   圆周率   enc   步骤   system   void   str   

原文地址:http://www.cnblogs.com/mawenqi-barry/p/7583798.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!