随机生成四则运算
package fee;
import java.util.*;
import java.util.Random;
public class pp {
static Scanner in =new Scanner(System.in);
static Random r = new Random();
public static void main(String[] args) {
System.out.println("输入题目数量:");
int x= in.nextInt();
//int r1=r.nextInt(100);
//int r2=r.nextInt(100);
System.out.println("输入1表示加法2表示减3表示乘4表示除:");
int y = in.nextInt();
switch(y){
case 1:
for(int i=0;i<=x;i++)
{
int r1=r.nextInt(100);
int r2=r.nextInt(100);
System.out.println(r1+"+"+r2+"=");}break;
case 2:
for(int i=0;i<=x;i++)
{
int r1=r.nextInt(100);
int r2=r.nextInt(100);
System.out.println(r1+"-"+r2+"=");}break;
case 3:
for(int i=0;i<=x;i++)
{
int r1=r.nextInt(100);
int r2=r.nextInt(100);
System.out.println(r1+"*"+r2+"=");}break;
case 4:
for(int i=0;i<=x;i++)
{
int r1=r.nextInt(100);
int r2=r.nextInt(100);
System.out.println(r1+"/"+r2+"=");}break;
}
}
}