Oct-01-2022, 08:22 AM
So I was required to solve this question: Write a program to use a while loop to read the numbers from the user repeatedly until he/she inputs 0. Then report the sum of these numbers and the minimum value among them.
And my code for the sum part is like this:
But when I run the code and input some integer, it does not show the sum although I have input a 0 lastly. Could someone tell me what the problem is in my code?
And my code for the sum part is like this:
1 2 3 4 5 |
sum1 = 0 n = int ( input ()) while n ! = 0 : sum1 + = n print (sum1) |