控制小数点位数(圆的面积为例)
import java.text.DecimalFormat;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner e = new Scanner(System.in);
double r = e.nextDouble();
double PI=3.14159265358979323;
DecimalFormat df=new DecimalFormat("0.0000000");
System.out.println(df.format((r*r)*PI));
}
}
数字过大用
BigInteger bi = new BigInteger("12345678");
3378

被折叠的 条评论
为什么被折叠?



