강의

멘토링

커뮤니티

Inflearn Community Q&A

rlawlsdn2632296's profile image
rlawlsdn2632296

asked

Introduction to Javascript Algorithm Problem Solving (Coding Test Preparation)

2. Identifying triangles

AND 연산자를 이용해 풀어봤습니다

Written on

·

223

0

삼각형이 만들어지기 위해선는 가장 짧은 두 변의 합이 가장 긴 변의 합보다 커야한다는 점에 착안해 AND 연산자를 이용해서 풀어봤습니다! (정삼각형 제외) 

function findTriangle(a, b, c) {
    let answer;
    if (a + b > c && b + c > a && c + a > b) answer = 'YES!';
    else answer = 'NO!';
    return answer;
}

findTriangle(6, 7, 11);
ANDjavascript&&코테 준비 같이 해요!

Answer

This question is waiting for answers
Be the first to answer!
rlawlsdn2632296's profile image
rlawlsdn2632296

asked

Ask a question