The_Minecrafter3

Untitled

Nov 12th, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Solution {
  4.  
  5. public static void main(String[] args) {
  6. Scanner input = new Scanner(System.in);
  7. Scanner input2 = new Scanner(System.in);
  8. int amount = input.nextInt();
  9. String num = input2.nextLine();
  10. String[] numbers = num.split(" ");
  11. input.close();
  12. input2.close();
  13. int result = 0;
  14. for(int i = 0; i < amount; ++i){
  15. int temp = Integer.parseInt(numbers[i]);
  16. result += temp;
  17. }
  18. System.out.println(result);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment