웅재의 코딩세상

[프로그래머스] 짝수와 홀수 본문

코딩테스트/프로그래머스 - LV 1

[프로그래머스] 짝수와 홀수

웅드 2024. 2. 9. 17:13

 

  • 풀이
#include <string>
#include <vector>

using namespace std;

string solution(int num) {
    string answer = "";
    if(num % 2 == 0){
        answer = "Even";
    }
    else{
        answer = "Odd";
    }
    return answer;
}
반응형