if문 까지 공부
This commit is contained in:
36
11. While.py
Normal file
36
11. While.py
Normal 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)
|
||||
Reference in New Issue
Block a user