-4
recently started my studies in programming and was doing a URI exercise in which I have to read an undetermined set of values M and N, where for each pair read, show the sequence of the smallest to the largest and the sum of consecutive integers between them (including N and M). Thinking on what the best way to solve me arose the following doubt, is it possible to make a loop of repetition within a Conditional Structure? Because I can solve this problem in a simpler way, but following a logic similar to repetition structures I can not at all present the correct result. Follow the link of the question: https://www.urionlinejudge.com.br/judge/pt/problems/view/1101
M = int(input(""))
N = int(input(""))
soma = 0
while True:
if (M <= 0 or N <= 0):
break
if (M >= N):
for N in range(N, M, 1):
print(N)
soma = soma + N
else:
for M in range(M, N, 1):
print(M)
soma = soma + M
print(soma)
M = int(input(""))
N = int(input(""))
Edit your question and paste the
link
of the question. Then we can read the statement and help you better.– Solkarped