개발자 미니민의 개발스터디

[백준 JAVA] 10101번 풀이 - 삼각형 외우기

by mini_min
package baekjoon;
import java.util.Scanner;
/**
* 삼각형 외우기
* 10101번
*
*삼각형을 잘 구분하지 못하는 창영이는 삼각형의 세 각을 입력받아 이를 외우려고 한다.
*
*/
public class _10101 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
if (a + b + c != 180)
{
System.out.print("Error");
}
else
{
if (a == 60 && b == 60 && c == 60) {
System.out.print("Equilateral");
} else if (a == b || b == c || c == a) {
System.out.print("Isosceles");
} else {
System.out.print("Scalene");
}
}
sc.close();
}
}

 

풀이

조건문을 적절하게 사용하면 쉽게 풀 수 있다.

 

 

블로그의 프로필 사진

블로그의 정보

개발자 미니민의 개발로그

mini_min

활동하기