当前位置:首页>维修大全>综合>

随机数字表怎么从表中任意指定行 列读取数字(如何从表格一串数字中提取出数字)

随机数字表怎么从表中任意指定行 列读取数字(如何从表格一串数字中提取出数字)

更新时间:2024-04-19 11:19:14

随机数字表怎么从表中任意指定行 列读取数字

1.你用输入输出流就可以的.

2.用类Math看看下面的代码

importjava.text.NumberFormat;

publicclassMath类的应用

{

publicstaticvoidmain(Stringargs[])

{

doublea=Math.sqrt(5);

System.out.println("格式化前:"+a);

NumberFormatf=NumberFormat.getInstance();

f.setMaximumFractionDigits(5);

f.setMinimumFractionDigits(3);

Strings=f.format(a);

System.out.println("格式化后:"+s);

System.out.println("得到随机数是:");

intnumber=8;

for(inti=1;i<=20;i++)

{

intrandomNumber=(int)(Math.random()*number)+1;

System.out.print(""+randomNumber);

if(i%10==0)

System.out.print("");

}

doublec,d,e;

c=123.456;

d=456.789;

e=Math.abs(c);

System.out.println("绝对值:"+e);

e=Math.max(c,d);

System.out.println("最大值:"+e);

e=Math.min(c,d);

System.out.println("最小值:"+e);

e=Math.pow(c,d);

System.out.println("C的D次幂:"+e);

e=Math.log(c);

System.out.println("c的对数:"+e);

e=Math.sin(c);

System.out.println("c的正弦值:"+e);

e=Math.asin(c);

System.out.println("反正弦值:"+e);

}

}

更多栏目