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>

¼³¸í

·£´ý¼ö¸¦ ¸¸µé°í ±× ¼ö¸¦ ¸ÂÃß´Â °ÔÀÓ~~ ^^