ab 사이에 없는 c
https://www.codetree.ai/trails/complete/curated-cards/intro-c-between-a-and-b-2/description
arr = input().split()
a,b,c = int(arr[0]), int(arr[1]), int(arr[2])
satisfied = True
for i in range(a, b+1):
if i % c == 0:
satisfied = False
if satisfied == True:
print("YES")
else:
print("NO")
소수 판별기
n = int(input())
satisfied = True
for i in range(2, n):
if n % i == 0:
satisfied = False
if satisfied == True:
print("P")
else:
print("C")
모두 3의 배수
https://www.codetree.ai/trails/complete/curated-cards/test-all-multiples-of-3/description
satisfied = True
for _ in range(5):
a = int(input())
if a % 3 != 0:
satisfied = False
if satisfied == True:
print(1)
else:
print(0)
'코딩테스트 > 프로그래밍 기초 | 단순 반복문' 카테고리의 다른 글
[코드트리] 단 하나라도 만족하는 경우 (0) | 2025.01.24 |
---|---|
[코드트리] 언제 끝날지 모르는 상황에서의 loop (0) | 2025.01.23 |
[코드트리] Infinite Loop (0) | 2025.01.22 |
[코드트리] break문 (1) | 2025.01.21 |
[코드트리] continue문 (0) | 2025.01.17 |