public class java1224 {
- h* c4 F' y, I3 t, s7 I
- e$ x( q7 z' N: ^: D9 q1 m) t5 C public void main(String[]arg){
9 M! d% ]( y) A int r[]=new int[42];
9 P! M* l! x, A# @6 x4 V! z for(int i=0;i<42;i++)
4 r6 W: W% s- t2 _8 X/ l0 B {9 U" m2 i% s( Q$ p9 ]/ ]
r[i]=i+1;
, c3 K. h# a+ M* A' ~+ [ }
! I9 M- ]4 C+ I4 t' t' @ for(int i=0;i<42;i++); K: a! k6 @! t9 {% W; J
{
; Z w( D$ \$ B int rr=(int)(Math.random()*42);0 X# R2 c1 H7 q0 Q* W: u
int t=r[i];
; p" F, L' I, z. ] r[i]=r[rr];5 A9 w% {4 n: j. L, }% ?
r[rr]=t;& ]. d9 C4 ^6 E$ V' e" \
}2 X5 j0 r0 u( n3 H
for(int i=0;i<6;i++)
' k( Q' P B# K/ S' T! k {- z+ O, X! d4 @, |* V4 W
//System.out.println("第"+(i+1)+"個號碼"+r[i]);+ ]8 O2 }% d' }+ W4 S9 q
System.out.printf("第%d個號碼:%02d",i+1,r[i]);
7 v) `, _: v/ C+ o& ?+ Y' H }
6 @ i" A+ A7 M4 R //System.out.println("特別號:"+r[6]); F0 B, d7 r* r- V/ m% M0 U
System.out.printf("特別號:%02d\n",r[6]); & r+ e) k5 d+ E% B
}; a' x4 N7 L/ d0 p3 Z
5 c* T/ q7 Y, }( ^; C: c' P1 l} |