hanker

백준(4153) JAVA - 직각삼각형 본문

Study/ALGORITHM

백준(4153) JAVA - 직각삼각형

hanker 2021. 6. 29. 09:37
반응형
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        while(true){
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();

            if(a == 0 && b == 0 && c == 0){
                break;
            }

            if((a * a) + (b * b) == c * c){
                System.out.println("right");
            } else if((c * c) + (b * b) == a * a){
                System.out.println("right");
            } else if((a * a) + (c * c) == b * b){
                System.out.println("right");
            } else {
                System.out.println("wrong");
            }
        }
    }
}
반응형