코딩테스트

[programmers] JAVA_0단계 n의 배수

congs 2024. 6. 16. 23:12

n의 배수

 

풀이

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;
    }
}