public class TQC207 { t2 T! O( ~3 Z" a
, M% e$ I* S4 h1 Z2 I
+ U3 j$ K% Y- n/ a public static void main(String[] args) {, `2 [( B, a* y0 D
int sum=0, even=0, max=0, tmp=0;
6 _9 F2 m2 r! M6 t. b) X int[] nums = new int[args.length];3 c2 c/ ]3 s. [3 E- O( Q. W P. n
try{6 Z( _+ s5 f4 u4 O
for(int i=0 ; i<args.length ; i++){
) i. n E0 z! @" { ? tmp= Integer.parseInt(args[i]);
( ?' q6 L& n1 A/ v- l- a _ nums[i] = tmp;1 R4 b0 F5 {8 z V7 }
sum += tmp;
+ E' p; r0 m- p% `$ f if((tmp%2)==0)0 U+ M3 [( Z$ Q) X$ ]9 Z' d
even++;( ^/ ]3 d' ^4 Q4 H5 f
max=Math.max(max,tmp);) d' a/ \" n& B/ K: a( g
4 D; ~6 j$ K2 N, [+ F, X6 a3 z
}
4 x( O( ~; } A6 m System.out.println("最大值"+"="+max);0 X- A8 J5 [* F; b8 _
System.out.println("偶數的個數"+"="+even);5 B5 N& l. Z* E4 o. Q |
System.out.println("數字總和"+"="+sum);9 c- {) B+ ^. Z5 C, z! P, g
& {( I, `0 n/ j9 j. m+ Q3 F/ c
9 C6 n1 V& I# r }
7 @% W8 M0 N# a" B, E* ] catch(Exception e){
! }: F& o! l0 o# ^, w% ~; G6 c }
0 Z. B. [1 X9 n }
3 W% z4 G2 f2 R7 h$ y6 K} |