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