(圆的面积和周长)编写程序,使用以下公式计算并显示半径为5.5的圆的面积和周长。
周长 = 2 × 半径 × π
面积 = 半径 × 半径 × π
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package dome1_8;
/**
*
* @author Administrator
*/
public class Dome1_8 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
double radius = 5.5;//半径
double pi = 3.14;
System.out.println("周长:" + (2 * radius * pi));
System.out.println("面积:" + (radius * radius * pi));
}
}