1101.Sequence of Number and Sum in python
This is the solution of this problem in python:
M=list()
N=list()
count=10
pcount=0
for i in range(0,count):
r,s=input().split()
M.append(r)
N.append(s)
tm=int(M[i])
tn=int(N[i])
if(tm<1 or tn<1):
break
else:
pcount+=1
for i in range(0,pcount):
summ=0
x=int(M[i])
y=int(N[i])
if(x>y):
x,y=y,x
for j in range(x,y+1):
print(j,end=" ")
summ=summ+j
print("Sum=%i"%summ)
No comments