Programming/프로그래머스

[프로그래머스] 소수 찾기

pental 2020. 10. 10. 20:43

 

 

def solution(n):
    count = 0
    for i in range(1, n+1):
        temp_cnt = 0
        for j in range(1,i+1):
            if i % j ==0:
                temp_cnt +=1

        if temp_cnt == 2:
            count += 1

    return count
저작자표시 비영리 (새창열림)