CodeMentor.
Ask AIProblemsLearnC++TCSCore CSHRProgress
0Lv 1
ProblemsHackerRank Warmup

Simple Array Sum

Easy
HackerRank
1/12
EasyHackerRank Warmup

Simple Array Sum

Add every number in the array. One loop, one running total.

Use long long if the numbers can be large — a habit from day one.

Examples

Example 1

Input

6
1 2 3 4 10 11

Output

31

Stuck? Take a nudge

C++17Autosaves