public class TQC207 {5 u* ^7 w9 Z% z; b' ^2 r
7 e1 T3 W N( k% ?
+ a) A! J% u' q, P0 \: m
public static void main(String[] args) {
, M* x% q; Q5 ] int sum=0, even=0, max=0, tmp=0;
" ^$ z2 H$ c. K- E) U int[] nums = new int[args.length];
8 O2 v" E; t2 Y# D+ ^1 k+ ~% ? try{
4 h* ?& [8 y- A0 I for(int i=0 ; i<args.length ; i++){& r6 q. f5 |* J& @' p
tmp= Integer.parseInt(args[i]);
- W" V! g w' c1 R nums[i] = tmp;
. J% E2 e5 Y' ]4 x }' L/ o, @ sum += tmp;
2 V- ]9 C5 c: `6 O if((tmp%2)==0), S$ O/ R( [# a4 F
even++;( E3 n0 {6 V" S/ y4 |& n
max=Math.max(max,tmp);
; t: m9 x# P( {' q9 X; F/ l: ]+ Q# j6 X 5 P3 ?1 r q9 Z3 v) K: u
}1 T% R7 ]) d# ]; t
System.out.println("最大值"+"="+max);
" P( E7 q: Z6 v/ m* I* k System.out.println("偶數的個數"+"="+even);# J4 u+ M4 x1 F1 l8 }! A" h/ g- x
System.out.println("數字總和"+"="+sum);0 j2 Z( b; ?) Q, n1 d8 c6 k
- L2 a# F( I4 K1 B8 e . ~# R6 E, L! q7 I ]+ I6 q
}/ d! m& |) D) o; `2 X
catch(Exception e){
- T) L. j7 I1 V9 ^* N }) n. I6 i8 P* h D2 f
}
8 ~' J# x: I6 X/ e1 g2 L} |