How to write a program that adds the numbers until user enters 0. | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

How to write a program that adds the numbers until user enters 0.

Help please

29th Jan 2021, 1:22 PM
Hyacenth Luyas
Hyacenth Luyas - avatar
4 Réponses
+ 1
In which programming language do you want to write your program? (Please tag the language) Please post your attempt, so we can help you solving the task.
29th Jan 2021, 1:38 PM
Lisa
Lisa - avatar
+ 2
Use loop and give condition like this If (number==0) Then break; Otherwise user input continue.
29th Jan 2021, 1:36 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
I do know much c++ but I think you need the curly brackets for your while loop {}. Also the condition for the while loop should be (number > 0) or !(number == 0) as you want to return and quit, when 0 is entered
29th Jan 2021, 1:59 PM
Lisa
Lisa - avatar
29th Jan 2021, 1:47 PM
Hyacenth Luyas
Hyacenth Luyas - avatar