Showing posts with label Sum of an array of numbers. Show all posts
Showing posts with label Sum of an array of numbers. Show all posts

Sum of an array of numbers

# Sum of an array of numbers

no_of_terms = int(input("Enter number of elements in array : "))
list1 = []

for val in range(0,no_of_terms,1):
    ele = int(input("Enter integer : "))
    list1.append(ele)

print("Sum of elements of list ", sum(list1))