풀이과정
짝수와 홀수 구하는 기본 문제이다.
#include <string>
#include <vector>
using namespace std;
string solution(int num) {
string answer = "";
if(num % 2 == 0) answer = "Even";
else if(num % 2 == 1) answer = "Odd";
return answer;
}
'🍞 Problem Solving > Programmers' 카테고리의 다른 글
[프로그래머스][Level1] 콜라츠 추측 c++ (0) | 2022.09.03 |
---|---|
[프로그래머스][Level1] 최대공약수와 최소공배수 c++ (0) | 2022.09.03 |
[프로그래머스][Level1] 직사각형 별찍기 c++ (0) | 2022.09.02 |
[프로그래머스][Level1] 제일 작은 수 제거하기 c++ (0) | 2022.09.02 |
[프로그래머스][Level1] 정수 제곱근 판별 c++ (0) | 2022.09.02 |