用java输出 给小朋友出加减法题目

//import java.util.Random;
/* 给小朋友出加减法题目 */
   public static void main(String[] args) {


       Random rd = new Random();
       for(int i=0;i<22;i++){
           String one = (rd.nextInt(100)+10)+" + "+(rd.nextInt(100)+10)+" =";
           if(one.length()==11)one+="      ";
           if(one.length()==10)one+="       ";
           if(one.length()==9)one+="        ";
           String two = (rd.nextInt(100)+10)+" + "+(rd.nextInt(100)+10)+" =";
           if(two.length()==11)two+="      ";
           if(two.length()==10)two+="       ";
           if(two.length()==9)two+="        ";

           String three,four;
           int a = (rd.nextInt(100)+10);
           int b = (rd.nextInt(100)+10);
           if(a>=b)
               three = a+" - "+b+" =";
           else
               three = b+" - "+a+" =";
           if(three.length()==11)three+="      ";
           if(three.length()==10)three+="       ";
           if(three.length()==9)three+="        ";
           int c = (rd.nextInt(100)+10);
           int d = (rd.nextInt(100)+10);
           if(c>=d)
               four = c+" - "+d+" =";
           else
               four = d+" - "+c+" =";
           if(four.length()==11)four+="      ";
           if(four.length()==10)four+="       ";
           if(four.length()==9)four+="        ";


           System.out.println(one+two+three+four);
       }
}

100 + 19 = 62 + 81 = 98 - 19 = 59 - 27 =
102 + 14 = 28 + 13 = 77 - 31 = 101 - 67 =
42 + 96 = 109 + 40 = 97 - 34 = 76 - 31 =
75 + 101 = 39 + 10 = 66 - 14 = 55 - 12 =
99 + 55 = 66 + 92 = 96 - 27 = 109 - 22 =
57 + 107 = 99 + 18 = 90 - 33 = 33 - 20 =
11 + 107 = 108 + 36 = 76 - 20 = 89 - 59 =
100 + 12 = 38 + 64 = 98 - 77 = 98 - 56 =
37 + 95 = 48 + 37 = 104 - 34 = 95 - 61 =
96 + 16 = 102 + 79 = 69 - 33 = 86 - 48 =
20 + 43 = 107 + 82 = 101 - 77 = 102 - 80 =
46 + 24 = 73 + 54 = 48 - 24 = 77 - 19 =
63 + 36 = 73 + 102 = 15 - 14 = 100 - 54 =
58 + 93 = 88 + 79 = 75 - 24 = 72 - 63 =
34 + 56 = 58 + 95 = 105 - 60 = 88 - 18 =
90 + 90 = 86 + 100 = 20 - 19 = 85 - 26 =
91 + 40 = 71 + 60 = 45 - 28 = 80 - 54 =
53 + 17 = 29 + 88 = 104 - 51 = 37 - 31 =
54 + 33 = 18 + 27 = 108 - 28 = 95 - 29 =
72 + 49 = 68 + 101 = 71 - 69 = 108 - 92 =
83 + 51 = 57 + 54 = 108 - 52 = 107 - 36 =
76 + 64 = 45 + 39 = 31 - 30 = 108 - 18 =

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值