Python: Write a program that makes sum of 1, 2, 3, … until the sum is over 1000.
#Python program to sum natural
numbers(1,2,3,4,5,6,7,8,9,10.................N) until
sum is over 1000
sum = 0
j=1
while sum < 1001:
sum=sum+j
j=j+1
print("\n \nthe sum of first ",j," natural numbers is",sum)
Screenshot code:
Get Answers For Free
Most questions answered within 1 hours.