2017년 11월 20일 월요일

[C++] HackerRank Day3 Solution

/*
https://www.hackerrank.com/challenges/30-conditional-statements/problem

*/

int main(){
    int N;

    cin >> N;
 
    if(N & 1){
        cout << "Weird" << endl;
    }
    else if((N>=2) && (N<=5)){
        cout << "Not Weird" << endl;
    }
    else if((N>=6) && (N<=20)){
        cout << "Weird" << endl;
    }
    else if(N>20) {
        cout << "Not Weird" << endl;
    }
    else {
        cout << "Unexpected number" << endl;
    }
   
    return 0;
}

댓글 없음:

댓글 쓰기