#Must input two numbers for the program to output back a message
1 messages · Page 1 of 1 (latest)
System.out.print("Enter a number (or 0 to exit): ");
int num = scanner.nextInt();
if(num == 0){
break;
}
sum += num;
}
System.out.println("The sum of the numbers is: " + sum);
}
}
well yes, since there are two nextInt
would it be better just to assign nextInt to a variable
yes