Victor has an array of size and he loves to play with the sun and numbers each time he play with them he pics of any two consecutive number and Odd then on adding both the number it cost him ke into some of both numbers find the minimum cost of adding all the numbers in array in python3
1
Expert's answer
2021-09-18T14:07:32-0400
def Sum(arr, n):
sum1 = 0;
for i in range(len(arr)-1):
sum1 = arr[i] + arr[i + 1]
print (sum1, end = " ")
list1 =[1, 2, 3, 4, 5]
n = len(list1)
Sum(list1, n)
Comments
Leave a comment