if문 까지 공부

This commit is contained in:
김민구
2021-04-26 20:40:14 +09:00
parent 30ef4cfbc7
commit 21d7d85b67
12 changed files with 420 additions and 3 deletions

36
11. While.py Normal file
View File

@@ -0,0 +1,36 @@
# while 반복문
i = 1
while i <= 10:
print("왓더 헬")
i += 1
# 1 ~ 100 수 중 짝수만 출력
i = 1
while i <= 100:
if i % 2 == 0:
print(i)
i += 1
i = 1
while i <= 50:
print(i * 2)
i += 1
# 100 이상의 자연수 중 가장 작은 23의 배수 출력
i = 100
while i:
if i % 23 == 0:
print(i)
break
i += 1
i = 100
while i % 23 != 0:
i += 1
print(i)