本帖最後由 johnson 於 2012-2-18 12:00 編輯 1 y9 O" s! `8 t, H
% X4 G( K1 b0 w" i% M4 G* r kimport java.util.*;! u" c8 R- l2 G0 T, C7 o$ l4 M3 }4 F
public class j201
4 F: X1 ^7 a: u- `( w{, n" l( k/ a, h/ Y$ o* y3 r
public static void main(String arg[])1 ]! Y- \& ] \/ V8 L
{; z E6 K$ D7 t+ @
Scanner s=new Scanner(System.in);7 U7 f- n5 B0 S2 Q, ~. u# V" ^
System.out.print("請輸入Z可能的最大值:");
- Z( z3 {0 G; v- o+ G# j J- q int z=Integer.parseInt(s.next());
/ b. Z/ X2 g. H5 u. |9 C. d int temp;
) Y* n, {% u# G! S4 {# y5 \ for(int x=1;x<=10;x++)
( U7 X7 t4 V9 C/ _ x {
/ ?+ v' A0 `: p int y=x*x*3+x*2+1;
* C$ f7 a, j0 |) K5 i O if(y<z)2 r$ @4 {& D" s3 g4 `5 I) ]
{
' O- Q) h* ^2 Q" H7 O6 c System.out.printf("x=%d,Y=%d,Z=%d,符合Y<Z的條件");
# }( U5 i, i m1 |& e break;4 z- z. F; k* r
}
3 i' ?) A& @5 T% k temp=y;# T5 z" Q" o# u% f/ h; W0 ~
}
& y0 m0 o m6 ?$ m. n0 d }5 {- B* }& ~) a* B/ C: h$ E
} |