标签:i++ 四则运算 math else oid for void str rand
public class Operation{
public static void main(String[] args) {
int first ;
int second ;
int third;
for (int i=0;i<300;i++){
first =(int) (Math.random()*100);
second = (int)( Math.random()*100);
third=(int)(Math.random()*4);
switch(third) {
case 0:
System.out.println(first +"+"+second+"=");
break;
case 1:
System.out.println(first+"-"+ second+"=");
break;
case 2:
System.out.println (first +"*"+ second+"=");
break;
case 3:
if(second==0){
second=(int)(Math.random()*100+1);
System.out.println(first+ "/" +second+"=");
}else{
System.out.println(first+ "/" +second+"=");
}
break;
}
}
}
}
标签:i++ 四则运算 math else oid for void str rand
原文地址:http://www.cnblogs.com/cjc10052/p/6532797.html