最大値と最小値の単純な配列を求めます

int[] arr={1,2,43,45,6,96,2};
int型の最大= -1;
int型分= -1;
for  ( int  i =  0 ; i < arr.length; i++) {
      int  temp = arr[i];
      if (i ==  0 ) {
          max = temp;
          min = temp;
       }
       if  (temp > max) {
           max = temp;
       }
       if  (temp < min) {
           min = temp;
       }
System.out.println(+分「分です」)。
System.out.println(+最大 "最高です");

 }

ます。https://www.cnblogs.com/jokerpan/p/3844396.htmlで再現

おすすめ

転載: blog.csdn.net/weixin_34077371/article/details/93565900