圆的面积

版权声明:禁止转载,翻版必究 https://blog.csdn.net/qq_41341757/article/details/83039318

Problem Description

Give you the radius of a circle,caculate its area,PI=3.141592653。

Input

The first line of the input is a positive integer N,then follows N lines,each line is a real number represent the radius of the circle.
Output

Output contains N lines,for each line of the input you should output one line, Case K: S,and K(count from 1)represents the number of the circle and S is the area.Keep two digits after the decimal point.
Sample Input

3
1
2
3
Sample Output

Case 1: 3.14
Case 2: 12.57
Case 3: 28.27


import java.util.Scanner;

import javax.print.attribute.standard.PrinterLocation;

public class Main
{

	public static void main(String[] args)
{
	Scanner reader = new Scanner(System.in);
	int n=reader.nextInt();
    for(int i=1;i<=n;i++)
	{
		int x=reader.nextInt();
		Size S=new Size(x);
		double y=S.div();
		System.out.printf("Case %d: %.2f\n",x,y);
	}
	reader.close();

}
}
 
 class Size
 {
	 int x;
	 public Size(int x)
	 {
		 this.x=x;
	 }
	 public double div()
	 {
		 return 3.141592653*x*x;
	 }
 }

猜你喜欢

转载自blog.csdn.net/qq_41341757/article/details/83039318
今日推荐