달력

72025  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

// 정수 세 개를 입력받아서 가장 큰 수 하나만 출력

import java.io.BufferedReader;
import java.io.InputStreamReader;

class MethodEx6
{

 public int big ( int a, int b, int c )
 {
  if( a> b && a > c ) return  a;
  else if( b > a ) return b;
  else return c;
 }

 public static void main( String[] args ) throws Exception
 {
  BufferedReader br = new BufferedReader ( new InputStreamReader (System.in) );

  System.out.print( "정수 1 : " );
  int a = Integer.parseInt( br.readLine() );
  
  System.out.print( "정수 2 : " );
  int b = Integer.parseInt( br.readLine() );

  System.out.print( "정수 3 : " );
  int c = Integer.parseInt( br.readLine() );

  MethodEx6 me = new MethodEx6();
  System.out.println( "큰 수 : " + me.big( a, b, c ) );
 }
}

Posted by cdprkr2077
|