Advertisement
YavorGrancharov

SumNumbers

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