标签:[] scanner public exti dom sys -- i++ can
package 编题程序;
import java.util.Random;
import java.util.Scanner;
public class 编题程xu {
public static void main(String args[]) {
System.out.println("请输入一页的题目数量:");
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int sum=1;
System.out.println("第"+sum+"份");
System.out.println("-----------------");
for(int i = 0 ; i < n;i++) {
int a = new Random().nextInt(100);//随机数a
int b = new Random().nextInt(100);//随机数b
int suijifu = new Random().nextInt(4);//随机运算符
String symbol=" ";
switch(suijifu) {
case(0):
symbol = "+";break;
case(1):
symbol = "-";break;
case(2):
symbol ="×";break;
case(3):
{ if(b==0) symbol = "+";
if(a%b!=0) symbol = "-";
if(a%b==0)symbol = "÷";
}
break;
}
System.out.println(a+" "+symbol+" "+b+"=");
}
System.out.println("-----------------");
sum++;
}
}
标签:[] scanner public exti dom sys -- i++ can
原文地址:https://www.cnblogs.com/zjl-0217/p/9753707.html