取圆周率为3.14.当我们输入半径r时,计算并输出面积s。

 

代码:

1 import java.util.*;
2 public class Main {
3     public static void main (String [] args) {
4         Scanner sc=new Scanner(System.in);
5         int r=sc.nextInt();
6         double s=3.14*r*r;
7         System.out.println(String.format("%.2f",s));
8     }
9 }

 

posted @ 2019-06-19 13:10  DehuiFan  阅读(1029)  评论(0编辑  收藏  举报