今天没有课,然后就背了20个单词,然后就是练习了一下随机生成30道四则运算的那道题。
public class count {
public static void main(String[] args) {
for(int i=0;i<30;i++){
int firNum=(int)(Math.random()*99)+1;
int secNum=(int)(Math.random()*99)+1;
int operaNum=(int)(Math.random()*4)+1;
if(operaNum==1){
System.out.println(firNum+"+"+secNum+"=");
}
if(operaNum==2){
System.out.println(firNum+"-"+secNum+"=");
}
if(operaNum==3){
System.out.println(firNum+"*"+secNum+"=");
}
if(operaNum==4){
if (secNum!=0&&firNum>secNum){
System.out.println(firNum+"/"+secNum+"=");
}
else if(firNum!=0&&firNum<secNum){
System.out.println(secNum+"/"+firNum+"=");
}
else {
System.out.println("30/15=");
}
}
}
}
}
标签:13,int,firNum,天气,System,2023,secNum,println,out From: https://www.cnblogs.com/Christmas77/p/17701055.html