public class TQC207 {
: ` U: `7 C/ K7 o+ [3 i9 {7 C
, S, Z4 q4 T k- X3 o& ]! K& }2 f& V" l8 c ~
public static void main(String[] args) {
4 K6 U+ a0 W/ H6 q/ t int sum=0, even=0, max=0, tmp=0;2 Y0 l& _' W8 g, T% o
int[] nums = new int[args.length];
5 X3 V! l" ]* L* m try{
O) Z+ @8 I9 U# k( U) B for(int i=0 ; i<args.length ; i++){- Q$ |4 x* T4 a/ u5 i8 S1 z
tmp= Integer.parseInt(args[i]);
$ ?- o- [. q2 R% w! } nums[i] = tmp;
% p. x2 Q, {* I- G sum += tmp;9 {8 \+ ^' H; d3 Q" [# w- \: l6 w" K
if((tmp%2)==0)
" B% v2 F8 }1 p( [+ ^6 n even++;$ ~9 J* V& V6 L, |9 o* q( ]
max=Math.max(max,tmp);
$ U+ J+ Q% x4 `9 m. d0 M+ X. ]
% R3 u! j4 C( e0 m }
+ s) m5 ^# q( K) z3 S2 d% M System.out.println("最大值"+"="+max);. Y: `! {$ e' D7 r( d
System.out.println("偶數的個數"+"="+even);
& [2 m# P- |5 W; ~0 X5 L0 k% p1 n System.out.println("數字總和"+"="+sum);% c( h' C, }6 J& z% t5 j* h/ J- K, }: N
5 J( o6 v& S4 s4 v# _, q; r: f4 ?
3 v* K; s2 Y# m- _) J# n
}
% |, z* l1 R* d- ?9 u4 w catch(Exception e){+ U( @& q% I& {
}7 S1 t3 r8 e1 T7 l
}
1 h$ ?/ J% c ]1 E# O& J7 E- N} |