Write a simple python program to print and add number starting 1 onward till the sum of them is less than 100
#the required output is as the n positive number having the total sum less than 100 are .
1 2 3 4 5 6 7 8 9 10 11 12 13 sum of the numbers =91
s = 0
n = 1
while True:
s += n
if s > 100:
break
else:
print(n, end=' ')
n += 1
Comments
Leave a comment