Question: I have a Computing 1 test on Tuesday I would like help with the past paper I am working on this question: Write a C++

I have a Computing 1 test on Tuesday

I would like help with the past paper I am working on this question:

Write a C++ program that uses an iterative loop to display to the screen the first fifteen numbers

of the Fibonacci sequence, in which each number is the sum of the two preceding ones.

This sequence should start from 0 and 1.

The output from your program should be as follows: 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377.

b.

What is the output of the following C++ program?

#include

using namespace std;

int main () {

int array[] = {0, 2, 4, 6, 7, 5, 3};

int n, result = 0;

for (n = 0; n < 8; n++) result += array[n];

cout << result;

return 0; }

a. 25 b.

30 c. 50

d. An erroneous value / out of bound runtime error

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 Databases Questions!