码迷,mamicode.com
首页 > 编程语言 > 详细

java实现随机输出300题四则运算

时间:2017-03-09 18:54:42      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:ima   http   for   util   style   port   image   sys   opera   

package demo;

import java.util.Random;

public class math {
       
    public static void main(String[] args) {
           
        String[] operate=new String[]{"+","-","×","÷"};
           int[] numbers=new int[1000];
           
           for(int i=1;i<=1000;i++){
           numbers[i-1]=i;
       }
          Random r=new Random();
      
          for(int i=0;i<300;i++){
      
              System.out.println(numbers[r.nextInt(1000)]+operate[r.nextInt(4)]+numbers[r.nextInt(1000)]+"=");
       }
      }
     }

 

技术分享

java实现随机输出300题四则运算

标签:ima   http   for   util   style   port   image   sys   opera   

原文地址:http://www.cnblogs.com/lippman/p/6526860.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!