Question: solve in c + + Constant NUM _ VALS represents the final number of elements in array valsList. Perform the following tasks: Read the element

solve in c++
Constant NUM_VALS represents the final number of elements in array valsList. Perform the following tasks:
Read the element at index 0 of valsList from input.
Read the element at index 1 of valsList from input.
For each element from index 2 to the end of valsList, assign the element with the sum of the two elements before that index.
#include
using namespace std;
int main(){
const int NUM_VALS =9;
int valsList[NUM_VALS];
int i;
/* Your code goes here */
cout << "Sequence: ";
for (i =0; i < NUM_VALS; ++i){
cout << valsList[i]<<"";
}
cout << endl;
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!