Advertisement
desislava_topuzakova

04. Sum Numbers

May 21st, 2018
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SumNumbrers {
  4.     public static void main(String[] agrs) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int n = Integer.parseInt(scanner.nextLine());
  7.  
  8.         int sum = 0;
  9.  
  10.         for(int i = 0; i < n; i++){
  11.             int number = Integer.parseInt(scanner.nextLine());
  12.             sum = sum + number;
  13.         }
  14.         System.out.println(sum);
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement