zoukankan      html  css  js  c++  java
  • java随机数程序

    import java.lang.Math;
    public class Answer1
    {
    public static 
    void main(String[] args) throws Exception
        {
            
    int num[]=new int[100];
            
    int i,max,min;  
            int j=0;
            
    for (i=0;i<100 ;i++ )
            {
                  num[i]
    =(int)(100*Math.random());
                  System.out.println(
    "num["+i+"]="+num[i]);
             }  
                max=num[0]; 
            
    for (i=0;i<100 ;i++ )
            {  

               
     if (num[i]>max)
                {
                    max
    =num[i];
                }
            }
            System.out.println(
    "this time the max number is "+ max);
            min=num[0];
                for (i=0;i<100 ;i++ )
            {  

               
     if (num[i]<min)
                {
                    min
    =num[i];
                }
            }
            System.out.println(
    " the min number is "+ min);
         
       for (i=0;i<100 ;i++ )
            {  

               
     if (num[i]>50)
                {
                    j++;

                }
            }
            System.out.println(
    "there is "+j+ "larger than 50");
         }
    }
  • 相关阅读:
    ASP.NET中使用附文本框插件
    HttpModules配置事项
    ASP.NET页面缓冲
    在ASP.NET中备份数据库以及还原(不成熟)
    python List使用
    SSH登录详解
    Vue.js使用-http请求
    Vue.js使用-组件示例(实现数据的CRUD)
    Vue.js使用-组件(下篇)
    Vue.js使用-组件(上篇)
  • 原文地址:https://www.cnblogs.com/moonson/p/87433.html
Copyright © 2011-2022 走看看