3.149.228.18´Ô ·Î±×ÀÎ ÇØÁÖ¼¼¿ä
MY wikix
óÀ½À¸·Î
³»¼Ò°³
»çÁø¹æ
°øºÎ¸Ç
ÀϱâÀå
¿µÈ±¤
µ¶¼±¤
À⵿»ç´Ï
¹æ¸í·Ï
À§Å° ÆäÀÌÁö
¸ðµç ÆäÀÌÁö
Àαâ ÆäÀÌÁö
º¯°æ ÆäÀÌÁö
°Ë»öÇϱâ
Today :
287
Total :
393487
ViewSource
|
info
| diff |
files
Check_number
ÄÚµå
import java.io.*;
import java.util.*;
class Check_number {
public static void main(String[] args)
{
BufferedReader input_s = new BufferedReader(new InputStreamReader( System.in ) );
int num = (int)( Math.random() * 100 ) + 1;
while(true)
{
System.out.print( "1~100 »çÀÌÀÇ ¼ýÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä = " );
try {
String input_string = input_s.readLine();
int input_num = Integer.parseInt(input_string);
if( input_num > num ) { System.out.println( "Å« °ªÀÔ´Ï´Ù." ); }
else if ( input_num < num ) { System.out.println( "ÀÛÀº °ªÀÔ´Ï´Ù." ); }
else { System.out.println( "Á¤´äÀÔ´Ï´Ù." ); break; }
}
catch( IOException ex ) {
ex.printStackTrace();
}
}
}
}
°á°ú
C:\Documents and Settings\ºü¹Ù±â\¹ÙÅÁ ȸé\java>java Check_number
1~100 »çÀÌÀÇ ¼ýÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä = 10
Å« °ªÀÔ´Ï´Ù.
1~100 »çÀÌÀÇ ¼ýÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä = 9
Å« °ªÀÔ´Ï´Ù.
1~100 »çÀÌÀÇ ¼ýÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä = 5
Å« °ªÀÔ´Ï´Ù.
1~100 »çÀÌÀÇ ¼ýÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä = 4
Å« °ªÀÔ´Ï´Ù.
1~100 »çÀÌÀÇ ¼ýÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä = 3
Å« °ªÀÔ´Ï´Ù.
1~100 »çÀÌÀÇ ¼ýÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä = 2
Å« °ªÀÔ´Ï´Ù.
1~100 »çÀÌÀÇ ¼ýÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä = 1
Á¤´äÀÔ´Ï´Ù.
C:\Documents and Settings\ºü¹Ù±â\¹ÙÅÁ ȸé\java>
¼³¸í
·£´ý¼ö¸¦ ¸¸µé°í ±× ¼ö¸¦ ¸ÂÃß´Â °ÔÀÓ~~ ^^
Last : 2008-03-14 18:16:20 Who : 222.118.152.172
Version : v1
1120 hit
s