프로그래밍

프로그래머스 C# 짝수와 홀수(음의 정수 생각하기, 나누기)

노마드선샤인 2023. 1. 23. 13:45
728x90

public class Solution {
    public string solution(int num) {
        string answer = "Even";
        
        if(num%2 != 0)
        {
            answer = "Odd";
        }

        return answer;
    }
}

 

//음의 정수가 나올 경우를 생각해서 짜야된다.

728x90