Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions