3초기억력

Method : 세 수를 비교하는 메서드 본문

자바_기초

Method : 세 수를 비교하는 메서드

잠수콩 2019. 5. 21. 15:25
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
/*
세 수를 비교하는 메서드를 정의
메서드명 : funt1
입력값 : 정수 3개!
반환값 : 제일큰 정수를 돌려준다.
			그 정수의 타입을 결정하면 된다.
*/

public class MethodEx2 {

	public static int funt1(int a, int b, int c) {
		if( a > b && a > c) {
			return a;
		} else if(b > a && b > c) {
			return b;
		} else {
			return c;
		}
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		int f1 = funt1(10, 20, 30);
		System.out.println("가장 큰수 : "+ f1);
		
		System.out.println("가장 큰수 : "+ funt1(100, 20, 30));
		
	}

}
Comments