''' 문 1. while 문으로 1 부터 300 까지 출력
i = 1
while i <= 300 :
print(i)
i += 1
''' 문 2. while 문으로 500 부터 2330 까지 출력
i = 500
while i <= 2330 :
print(i)
i += 1
''' 문 3. while 문으로 100 부터 -25 까지 출력
i = 100
while i >= -25 :
print(i)
i -= 1
문제 2.=============================================
''' 문제 : 1부터 1000 사이의 수 중에서 3의 배수만 출력해주세요.
i_2 = 3
(1번형태 답 3씩 그냥 증가)
while i_2 <= 1000 :
print(i_2)
i_2 += 3
(2번 형태 답 - 나머지로 확인)
while i_2 <= 1000 :
if i_2 % 3 == 0 :
print(i_2)
i_2 += 1
''' 문제 3 ========================
''' 1부터 5까지의 합을 출력해 주세요
''' 출력 합만 출력 해야 된다.
i = 1
i_tot = 0
while i <=5 :
i_tot += i
i += 1
print("1부터 5까지의 합은 " + str(i_tot))
(결과) 1부터 5까지의 합은 55
''' ===================================
while 에서 break, continue 명령 실행 하기
i = 1
while True :
if i % 2 == 0 :
continue
print(i)
if i == 100 :
break
i += 1 # 해당 명령어는 while 문 내에 존재 해야 함. 아니면 무한루프