deyanivanov966

07. Sum Numbers

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