Python/BOJ
[Python] 백준 10952 A + B - 5
Holywat2r
2021. 8. 21. 12:42
https://www.acmicpc.net/problem/10952
10952번: A+B - 5
두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
www.acmicpc.net
while True:
a , b = map(int,input().split())
if a == 0 and b == 0:
break
else:
print(a + b)
코드 해석
https://holywat2r.tistory.com/115
[Python] 파이썬 while 반복문
1. while 반복문 * 조건이 참인 동안 계속 반복을 실행한다 a = 5 while a =! 0: print(a) a -= 1 5 4 3 2 1 * a 값이 5 이므로 while 문 조건 (0이 아닐경우)을 만족하므로 해당 반복문 실행 * 파이썬은 -- 나 ++..
holywat2r.tistory.com
while True: # 해당 반복문을 계속 실행
a , b = map(int,input().split()) # a, b 값을 받아들임
if a == 0 and b == 0: # a, b가 둘다 0 일경우 while문 탈출
break
else: # 그렇지 않다면 a + b 실행
print(a + b)