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");
         }
    }
  • 相关阅读:
    cookie行为试验(一)
    指针内容的引用
    多线程协同
    xss攻击
    _com_error e
    操作符重载
    c++对象中的成员变量地址分布
    常对象指针
    COM调用2
    cookie行为试验(二)
  • 原文地址:https://www.cnblogs.com/moonson/p/87433.html
Copyright © 2011-2022 走看看