Find the area of a circle with a specified radius

package cn.tedu.basic;
import java.util.Scanner;
/ **

  • Requirements: find the area of ​​the specified radius circle

  • Formula: The area of ​​a circle: Π r r
    */
    public class Test3_CircleArea {

    public static void main(String[] args) { //2. Prompt the user to enter the radius value to be calculated: System.out.println("Please enter the radius value you want to calculate:"); //3. Use to define variables To save the radius value //4. Receive the radius value entered by the user //Scanner needs to be imported when using the package double r = new Scanner(System.in).nextDouble();





     //5.根据用户在键盘上输入的半径值计算圆的面积
     double circlearea = 3.14*r*r;
     System.out.println("圆的面积为:"+circlearea);
    

    }

}

Guess you like

Origin blog.csdn.net/qq_47386653/article/details/114268562