본문 바로가기
IT_tech/알고리즘

프로그래머스)-짝수와홀수

by 신드로 2020. 6. 30.

2로 나눴을때로 분기하면 완료 됩니다.

 

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