mathcalc.java
来自「Java2入门经典第二章源码」· Java 代码 · 共 18 行
JAVA
18 行
public class MathCalc
{
public static void main(String[] args)
{
// Calculate the radius of a circle
// which has an area of 100 square feet
double radius = 0.0;
double circleArea = 100.0;
int feet = 0;
int inches = 0;
radius = Math.sqrt(circleArea/Math.PI);
feet = (int)Math.floor(radius); // Get the whole feet and nothing but the feet
inches = (int)Math.round(12.0*(radius - feet));
System.out.println("The radius of a circle with area " + circleArea +
" square feet is\n " + feet + " feet " + inches + " inches");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?