Advertisement
martinvalchev

Sum Numbers

Nov 4th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 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.         int n = Integer.parseInt(scanner.nextLine());
  7.         double sum = 0;
  8.  
  9.         for (int i = 0; i < n ; i++) {
  10.             int curentNumeber = Integer.parseInt(scanner.nextLine());
  11.             sum += curentNumeber;
  12.         }
  13.         System.out.println(sum);
  14.  
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement