Summation

  • 4
  • Locked
Let's write a program that reads integers from the keyboard and calculates their sum until the user enters the word "ENTER". Display the sum and terminate the program.
You can't complete this task, because you're not signed in.
Comments (1)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Evilpanda H.
Level 10 , Taiwan, Province of China
10 November 2022, 12:08
If we declare a variable inside the loop, will the program generate many same variables due to the running of the loop over and over again? for example: while (!isExit) { int number = scanner.nextInt(); //will it declare many "number" variable? } Should I declare the variable outside the loop?