Java 程序查找圆的周长
圆的周长等于其半径和 PI 值的乘积的两倍。因此,为了计算圆的周长
- 从用户处获取圆的半径。
- 计算乘积
- 打印最终结果。
示例:求圆的周长
import java.util.Scanner;
public class CircumfrenceOfCircle {
public static void main(String args[]){
int radius;
double circumference;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the radius of the circle ::");
radius = sc.nextInt();
circumference = Math.PI*2*radius;
System.out.println("Circumference of the circle is ::"+circumference);
}
}输出
Enter the radius of the circle:: 55 The circumference of the circle is::345.57519189487726
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP