본문 바로가기

Algorithm

C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 5988번:홀수일까 짝수일까 답

반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <cstring>
using namespace std;
int main() {
    int t;
    char k[61];
    cin >> t;
    while (t--)
    {
        memset(k, 0sizeof(k));
        cin >> k;
        if (k[strlen(k) - 1] % == 0
            cout << "even" << '\n';
        else
            cout << "odd" << '\n';
    }
}
cs