wiley_pastebin

scanner 2

Mar 15th, 2019
3,020
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.27 KB | None | 0 0
  1. //...
  2. private void demoInput() {
  3.  int total = 0;
  4.  int input = 0;
  5.  do {
  6.   System.out.println("Insert an integer (0 to quit): ");
  7.  
  8.   input = s.nextInt();
  9.   total += input;
  10.  
  11.   System.out.println("Running total is: " + total);
  12.  } while(input != 0);
  13. }
  14. //...
Advertisement
Add Comment
Please, Sign In to add comment