Input contains many lines(at least two), each line contains 1 integer number(bigger than 0) and the last line is a single '%'. Print the second large number, according to the following example.
Samples Input:
10
9
24
21
6
12
%
Samples Output:
SECOND LARGE NUMBER = 21

解决方案 »

  1.   

    $a=array('1','3','55','99');unset($a[max($a)]);
    echo max($a):
      

  2.   

    <?php
    //返回第二大的数//数据数组
    $num = array(10,9,24,21,6,12);
    //数组排序
    sort($num);
    //输出数组
    //var_dump($num);
    //第一大
    echo "第一大:". max($num) . "<br/>";
    //名值对调
    $num2 = array_flip($num);
    echo "第二大:" . $num[$num2[max($num)] - 1];
      

  3.   

    不太明白需求,输入换行数据,分解时就是explode(str,'\n'),解析成数组,然后sort排序即可。
      

  4.   

    数组元素排序
    Array.sort()请及时结帖。