반응형
class Max3{
public static void main(String[] args){
Sanner stdIn = new Scanner(System.in);
System.out.println("세정수의 최댓값을 구합니다");
System.out.print("a의 값"); int a = stdIn.nextInt();
System.out.print("b의 값"); int b = stdIn.nextInt();
System.out.print("c의 값"); int c = stdIn.nextInt();
int max = a;
if(b> max)
max=b;
if(c>max)
max=c;
System.out.println("최댓값:"+max+);
}
}
최댓값 구하는 알고리즘.
반응형
'알고리즘' 카테고리의 다른 글
recursion으로 미로찾기 (0) | 2020.06.23 |
---|---|
recursion - 순차탐색, 이진트리탐색 (0) | 2020.06.09 |
순환함수(재귀함수, Recursion) (0) | 2020.06.04 |
댓글