Given an array of integers, find the sum of its elements. For example, if the array ar = [1,2,3] , 1 + 2 + 3 = 6
Input Format: The first line contains an integer,n , denoting the size of the array. The second line contains n space-separated integers representing the array's elements.
Contraints: 0 < n, ar[i] <= 1000
Output Format: Print the sum of the array's elements as a single integer.
Sample Input: 6 1 2 3 4 10 11
Sample Output: 31
Explanation:
We print the sum of the array's elements: 1 + 2 + 3 + 4 + 10 + 11 = 31
I changed a bit in the approach. While the first line is the no of inputs i.e., numbers which we have to add. By mistaken user gives a mismatching Size at firstline or gives a wrong no of inputs in second line, we have to intimate them as "Invalid Input" or "Size Mismatched". HackerRank-Algorithms-warmup-Simple_Array_Sum.py file never shows the result until the user gives correct input i.e., the no of Inputs and length of array gets matched.