Teacher zapp

Adding

  • 3
  • Locked
  • Homework
What could be simpler and more pleasant than adding numbers? Especially for a robot. Let's write a program where the user enters numbers from the keyboard, and then a special method sums up the entered numbers. And does so until the user gets bored. When the user is bored, he or she enters -1: the program will understand that it's time to wrap things up, and will then display the sum on the screen.
You can't complete this task, because you're not signed in.
Comments (5)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Alen VlahovljakLevel 7 , Sarajevo
14 June, 16:12
Here is the right answer:
/* DELETED */
RomanLevel 41
18 June, 06:26
Posting the solution in the comments is prohibited.
KIN SOCHEATLevel 14 , Phnom Penh
15 May, 03:52
why not work break; someone can help please
int b= 0;

        while (true) {
            int nN1 = Integer.parseInt(sN1);

            if (nN1 != -1){
                b = b+nN1;
              //  break;
            }else {
                b = b+nN1;
                break;
            }
        }
        System.out.println(b);
      }
}
PremachandranLevel 19 , Ernakulam
15 October 2018, 13:32
Pl help. Where the code has gone wrong?
RomanLevel 41
16 October 2018, 06:05
If you need help, something isn't right in your code, the server won't accept your solution (even if you are 100% sure that it is correct). Describe your question/issue in the HELP section at codegym.cc/help.