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.
Summation
- 4
Locked
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
Evilpanda H.
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?
0