Programmers Solutions/Level-1
[프로그래머스] 짝수와 홀수
률무차
2021. 2. 2. 01:11
title: "짝수와 홀수"
category: 프로그래머스[Level-1]
tags: [C++, JavaScript, 프로그래머스]
date: "2021-01-20"
문제 링크
C++
#include <string>
#include <vector>
using namespace std;
string solution(int num) {
string answer = "";
answer = num & 1 ? "Odd" : "Even";
return answer;
}
JavaScript
function solution(num) {
var answer = "";
answer = num & 1 ? "Odd" : "Even";
return answer;
}
728x90
반응형