public class TQC207 {+ S n& ?( H5 _4 G& g
- s' E* Y1 D: T. G, ], h
q6 ]$ z' v" y/ O9 P public static void main(String[] args) {
5 R, @( {( M' V int sum=0, even=0, max=0, tmp=0;7 M/ q* r ?$ I" I' { r
int[] nums = new int[args.length];
1 [; ]" }" ^, e- B try{3 l6 u/ u s# s1 e
for(int i=0 ; i<args.length ; i++){8 E7 d& S1 z* }1 r! X/ d
tmp= Integer.parseInt(args[i]);+ I/ ]/ c* U6 g8 W7 K
nums[i] = tmp;# y! x1 m$ I( I5 C ^: B6 ?+ Y! i
sum += tmp;
! d$ K' T1 n4 ~) F5 g/ f if((tmp%2)==0)5 E- c$ g( D) Y
even++;9 m. L+ [' V; A1 ?/ ?1 |
max=Math.max(max,tmp);
* \4 W" M( e& ]& w9 f1 C! A
: p- c, i( a# A } w5 j! Z; I* L, T. a/ f0 U
System.out.println("最大值"+"="+max);
/ o+ l* T8 {9 D3 L1 t System.out.println("偶數的個數"+"="+even);
% p+ a* ]8 ]6 j @2 E. F8 d! ] System.out.println("數字總和"+"="+sum);4 v4 c- _, y! `
/ \9 {: I/ H$ z% ^5 O
' P4 y' b& @2 T9 y: I! b. P4 L }' A, m7 k/ m7 N1 T
catch(Exception e){
. b, l: L5 C, S }
' S& M$ a; E# W1 g% p4 W3 e* J: T }; ^5 {$ s; \9 l
} |