[프로그래머스] n의 배수

Seah Lee·2023년 6월 19일
0

프로그래머스

목록 보기
9/57

class Solution {
    public int solution(int num, int n) {
        
        if (num%n==0) return 1;
        else return 0;

    }
}

[다른 사람의 풀이]

class Solution {
    public int solution(int num, int n) {
        int answer = num % n == 0 ? 1 : 0;
        return answer;
    }
}
profile
성장하는 개발자

0개의 댓글