- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

In this article, we will learn about the solution and approach to solve the given problem statement.

Given an array as an input, we need to compute the sum of the given array.

Here we may follow the brute-force approach i.e. traversing over a list and adding each element to an empty sum variable. Finally, we display the value of the sum.

We can also perform an alternate approach using built-in sum function as discussed below.

# main arr = [1,2,3,4,5] ans = sum(arr,n) print ('Sum of the array is ',ans)

15

All the variables & functions are declared in the global scope and are shown below.

In this article, we learnt about the approach to find the sum of an array.

- Related Questions & Answers
- Find the sum of array in Python Program
- Program to find running sum of 1d array in Python
- Java program to find the sum of elements of an array
- Python program to find the sum of sine series
- Program to find sum of the sum of all contiguous sublists in Python
- Program to find sum of absolute differences in a sorted array in Python
- Program to find the maximum sum of circular sublist in Python
- Program to find the sum of largest K sublist in Python
- Program to find maximum weighted sum for rotated array in Python
- Python program to find sum of elements in list
- Python program to find Cumulative sum of a list
- Program to find sum of unique elements in Python
- C/C++ Program to find the sum of elements in a given array
- Program to find sum of contiguous sublist with maximum sum in Python
- Program to find the sum of all digits of given number in Python

Advertisements