package h.classroompratise;
/*作者:陈天祥
时间:2016-10-12
功能:随机数方法的使用 math.random()*/
public class While_1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int a,b;
a=(int)(Math.random()*10+1);
System.out.println("a="+a);
while(true) {
b=(int)(Math.random()*10+1);
System.out.println("b="+b);
if(a==b)
break;
}
System.out.println("a="+a+"and b="+b);
}
}
/*作者:陈天祥
时间:2016-10-12
功能:随机数方法的使用 math.random()*/
public class While_1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int a,b;
a=(int)(Math.random()*10+1);
System.out.println("a="+a);
while(true) {
b=(int)(Math.random()*10+1);
System.out.println("b="+b);
if(a==b)
break;
}
System.out.println("a="+a+"and b="+b);
}
}