Advertisement
Kancho

Sum_Of_Integers

Feb 26th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. Scanner key = new Scanner (System.in);
  2. int n = Integer.parseInt(key.nextLine());
  3. int sum = 0;
  4. while (n -- > 0) {
  5. sum += key.nextLine().charAt(0);
  6. }
  7. System.out.printf("The sum is %d", sum);
  8. }
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement