Welcome to Westonci.ca, the place where your questions are answered by a community of knowledgeable contributors. Get expert answers to your questions quickly and accurately from our dedicated community of professionals. Our platform offers a seamless experience for finding reliable answers from a network of knowledgeable professionals.

Write a program that asks the user for a positive nonzero integer value. The program should use a loop to get the sum of all the integers from 1 up to the number entered. For, example if the user enters 50 , the loop will find the sum of 1,2,3,4,...,50. while loop

Sagot :

num = 0

while num <= 0:

   num = int(input("Enter a number: "))

i = 1

total = 0

while i <= num:

   total += i

   i += 1

print(total)

I wrote my code in python 3.8. Best of luck.

We hope you found this helpful. Feel free to come back anytime for more accurate answers and updated information. We appreciate your visit. Our platform is always here to offer accurate and reliable answers. Return anytime. Get the answers you need at Westonci.ca. Stay informed by returning for our latest expert advice.