Advertisement
tchenkov

L05u04_SumNumbers

Feb 8th, 2017
524
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class u04_SumNumbers {
  4.     public static void main(String[] args) {
  5.  
  6.         Scanner scan = new Scanner(System.in);
  7.  
  8.         int numberCount = Integer.parseInt(scan.nextLine());
  9.         int sum = 0;
  10.  
  11.         for (int i = 0; i < numberCount; i++) {
  12.             int currentNumber = Integer.parseInt(scan.nextLine());
  13.             sum += currentNumber;
  14.         }
  15.  
  16.         System.out.println(sum);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement