you are given on integer N and integer array A as the input where N denotes the length of A.write a program to find the product of every element with its next consecutive integers on the number line and return the sum of these products
Answers
Answer:
here this your answer
Explanation:
make a brilliant
Answer:
Code:
import numpy as np
N + int (input("Enter the number of elements: "))
print()
l = list()
for i in range (N)
nm = int (input( "Enter the number: ))
l.append(nm)
print()
A = np.array(l)
print(A, "is the given array.")
print()
prod_dict = dict()
for i in A:
prod_dict[i] = i * (i + 1)
print(sum(prod_dict.values() ), "is the required output.")
For more computer-related Questions click the link:
https://brainly.in/question/48380911
#SPJ2
Explanation:
numpy library is needed to create an array. To store the numbers entered, a list is created. 'prod_dict' dictionary is created to store the product elements with their consecutive numbers on the number line. Finally, the sum is printed in print() statement.