-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yjhss
committed
Apr 12, 2023
1 parent
4b83916
commit 30a47d3
Showing
1 changed file
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
n = int(input()) # 수의 개수 N 입력 받기 | ||
numbers = map(int, input().split()) # N개의 수 입력 받기 | ||
count = 0 # 소수의 개수를 세기 위한 변수 count 초기화 | ||
|
||
for num in numbers: | ||
a = 0 | ||
if num > 1 : | ||
for i in range(2, num): # 2부터 (num-1)까지 (자기자신 제외) | ||
if num % i == 0: | ||
a += 1 # 2와 (num-1) 사이 숫자로 나누어 떨어지면 a 1씩 증가 | ||
if a == 0: | ||
count += 1 # a == 0 이면 소수이므로 count 1씩 증가 | ||
print(count) |