sum | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

sum

ive modified it to ask a user to enter the integer values. but i want to write the statement so that: if the user inputs a negative integer, thats when it adds all the outputs, using the if else. https://code.sololearn.com/cAL0o881L54Z/?ref=app

14th Sep 2021, 5:34 PM
Bobby Dike
Bobby Dike - avatar
7 Answers
+ 1
Enter a positive integer: 5 Enter next value: (any value) Enter next value: (any value) Enter next value: (any value) Enter next value: (any value) The sum of all outputs is: (sum of all values entered)
14th Sep 2021, 5:46 PM
Bobby Dike
Bobby Dike - avatar
0
Can you please give an example of your expected output?
14th Sep 2021, 5:40 PM
Atul [Inactive]
14th Sep 2021, 5:52 PM
Atul [Inactive]
0
doesn't work
14th Sep 2021, 6:10 PM
Bobby Dike
Bobby Dike - avatar
0
it still adds after i input a negative number
14th Sep 2021, 6:11 PM
Bobby Dike
Bobby Dike - avatar
0
What input you gave and what was your expected output?
14th Sep 2021, 6:23 PM
Atul [Inactive]
0
thanks for trying, ive figured it out
14th Sep 2021, 6:26 PM
Bobby Dike
Bobby Dike - avatar