Need help on this problem from hacker earth guys pls help


#1

Monk is outside a cave and there are rules to enter. Monk is given an array of integers
A. He has to find the sum of the integers in the array.

Step 1: The first line of the Input consists of a single integer N denoting the size of the array.

Step 2: The next line of Input consists of
N 'space separated integers' denoting the elements of this array.

The maximum size of the array can be
100. You need to find the sum of all the elements in the array and print it to output.

Help: How does Input works here?

SAMPLE INPUT
5

1 76 8 45 56
SAMPLE OUTPUT
186

help....


#2

Methods and functions that you need:


Algorithm:

  1. Take first number as input, don't save it in the variable, we don't need it.
  2. Take second line as input, split it, turn all the elements of list into numbers, return sum of the list.

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.