public class TQC207 {
4 m8 v w: Z4 B" a0 y2 M9 ^, Z
+ |2 N) J/ d9 Q+ z/ T Y" b t# |% ]' j% U* N5 Y3 `- I. J$ X
public static void main(String[] args) {
" ~' o' q0 k* F/ U% `0 m" E) a int sum=0, even=0, max=0, tmp=0;# _ e& j" N8 ?3 A0 J6 e! S4 A4 o% {8 M
int[] nums = new int[args.length];
2 O# w, \/ N; M$ j# z- s4 @ try{: h& q# y; D3 I' p& P
for(int i=0 ; i<args.length ; i++){; ]1 P+ Z/ {( E" n7 ?
tmp= Integer.parseInt(args[i]);# m( I9 x% W1 X r6 { a+ ]
nums[i] = tmp;$ h' _, K F& J% w
sum += tmp;' b$ b4 ?0 L1 z' b3 B
if((tmp%2)==0)
( {* v: ~- Y; u1 A( a, e& s) n even++;
6 I3 W/ N8 \- c+ T1 K* L max=Math.max(max,tmp);
# W- h% F. F% `& z8 ]
3 U! z% s% e+ T4 D( A4 `) D2 { }$ h! [" s- H: Y6 z! c1 D( K
System.out.println("最大值"+"="+max);! l% ~% V9 o; }0 ^1 k1 Q$ K
System.out.println("偶數的個數"+"="+even);
; m7 M; R0 B: s/ Q- I8 S; O+ v: J System.out.println("數字總和"+"="+sum);9 S8 z, G. I* p6 e9 M) ~+ T
; y) H! m% i: s+ J# a- l6 Q
- W: ?2 d) d! F# p }1 p% A( S2 j# R4 M: [
catch(Exception e){+ P/ x6 w& D3 l$ W5 h8 I
}
. q6 T3 g8 g( h! L }; j* Y* O" [, Q( f. q
} |