BackmediumIntroduction to Arrays introduction-to-arrays medium

Sum of Array Elements Solution

Problem Statement

Given an array of integers, calculate the sum of all its elements.

Example 1
Input
[10, 20, 30, 40, 50]
Output
150

Explanation: The sum of all array elements is 10 + 20 + 30 + 40 + 50 = 150.

Constraints

  • The input array can be empty.
  • The array elements can be positive, negative, or zero.
  • The array elements can be integers or floating-point numbers.
  • The array elements do not repeat.

More Introduction to Arrays Problems

View all problems →
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free