Posts [알고리즘] 프로그래머스 - 행렬의 덧셈
Post
Cancel

[알고리즘] 프로그래머스 - 행렬의 덧셈


문제

행렬의 덧셈


접근


코드

  • C++ 코드
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <string>

using namespace std;

string solution(int num) {
    string answer = "";
    if(num%2 == 0){
        answer = "Even";
    }
    else{
        answer = "Odd";
    }
    return answer;
}
  • 파이썬 코드
1
2
3
4
5
6
def solution(num):
    if num % 2 ==0:
        answer = 'Even'
    else:
        answer = 'Odd'
    return answer


This post is licensed under CC BY 4.0 by the author.

[알고리즘] 프로그래머스 - 짝수와 홀수

[알고리즘] 프로그래머스 - x만큼 간격이 있는 n개의 숫자