[프로그래머스]합성수 찾기

박예림·2023년 3월 29일
0

코테

목록 보기
57/132

class Solution {
    public int solution(int n) {
        int answer = 0;

        for (int i=4; i<=n; i++) {
            int tem = 0;

            for (int j= 1; j<=i; j++) {
                if (i%j ==0) {
                    tem++;
                }
            }
            if(tem>=3){
                answer++;
            }
        }
        return answer;
    }
}
profile
응애 나 아기개발자

0개의 댓글

Powered by GraphCDN, the GraphQL CDN