public class TQC207 {
- h- P, f: J5 B' w& B" Z2 \1 n; Y" H9 r2 x. b/ e
' v7 d; E# r {$ ? public static void main(String[] args) {! k7 ^; y2 i% ~2 v
int sum=0, even=0, max=0, tmp=0;: J6 l0 f- X, q5 k
int[] nums = new int[args.length];
! l+ o( v; ?. n6 L4 c8 `* a try{* }+ {( M( B1 Y" v# _ P
for(int i=0 ; i<args.length ; i++){0 ~8 |7 x- T8 r& Q
tmp= Integer.parseInt(args[i]);
" y1 D! U, e. v$ r nums[i] = tmp;" O% ~; d3 t9 o: _# u% v
sum += tmp;
3 I" q5 Q6 k. P3 r( C1 _' R# i9 h3 s if((tmp%2)==0): {3 d7 p+ G" Z6 a
even++;
# E; U7 V$ k% @' n' n" W0 t2 \# k0 D max=Math.max(max,tmp);
7 ] P2 r& Y9 s: T3 W, e # l8 B9 W) P8 G) e+ ]6 a4 q
}
( h0 |& ~% @7 C# @8 m- U+ x System.out.println("最大值"+"="+max);2 o+ L. t; \! P! a2 [
System.out.println("偶數的個數"+"="+even);1 h) w, o; a6 [/ Q! Z, p9 u
System.out.println("數字總和"+"="+sum);
" i1 [. F3 N' P8 i4 K
5 @8 G! x8 b( f! u6 r A( r ) }) R$ c4 r: s7 V5 z1 |1 L
}+ @% P( _0 G' \7 K0 ~
catch(Exception e){# X+ L* s) W0 j. R
}. a+ c* C1 H# V/ ^7 s" Z
}
P0 `7 ?. f( V} |