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");
         }
    }
  • 相关阅读:
    CSS中的小知识
    网络基础 中的osi七层 协议
    pickle的使用
    max()的key的运用
    read,readline,readlines的区别
    print()控制台输出带颜色的方法
    写项目时bin目录下的start中的细节(路径问题的解决)
    使用hashlib密文存储实例
    固态硬盘使用f2fs作为根分区安装linux
    工厂方法(Factory Method)
  • 原文地址:https://www.cnblogs.com/moonson/p/87433.html
Copyright © 2011-2022 走看看