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
Answered by
1
Answer:
Answer is A
Compare: 27.7 ____ 27.77
Answered by
0
Title:
C++ Programming.
Explanation:
- N is the integer variable.
- A is the array of integer type.
- N denotes the size of the array A.
- First we need to get the size of the array from the user.
- We can get the size of the array with the help of "cin" command in C++.
- Then the size of the array is stored in the variable N.
- With the help of for loop the user can assign the values in the array.
- After the values are assigned in the array A, with the help of another for loop each and every element in the array is multiplied with the next consecutive element in the array that is, in loop1 the value in index 0 is multiplied with the value in index 1 and the value in index 0 stores the multiplied value. This step is processed till the last iteration.
- Once every value in the array is multiplied with the next consecutive value and stored the variable sum of integer type is declared.
- Initially the sum is assigned as 0.
- Then with the help of for loop sum value is added with each of the values of the array that is, initially the sum is 0 in the loop1 sum is added with the value in index 0 of the array and the added values is stored in sum and now in loop2 the sum value is added with the value in index 1 and stored in sum and so on.
- After all the iteration sum stores the value of sum of every element in the array.
- Finally the sum in displayed with the help of "cout" command.
Similar questions
Math,
2 days ago
Physics,
2 days ago
Environmental Sciences,
4 days ago
English,
8 months ago
Math,
8 months ago