Answer to Question #312166 in C++ for cobet

Question #312166

The following algorithm is designed to print the beginning of what is known as the


Fibonacci sequence. Identify the body of the loop. Where is the initialization step for the


loop control? The modification step? The test step? What list of numbers is produced?


Last ← 0;


Current ← 1;


while (Current < 100) do


(print the value assigned to Current;


Temp ← Last;


Last ← Current; and


Current ← Last + Temp)

1
Expert's answer
2022-03-15T12:59:55-0400

Here is program:

int main()
{
	int Last;
	int Current = 1;
	int Temp;
	cin >> Last;
	cin >> Temp;
	Current = Last + Temp;
	while (Current < 100)
	{
		cout << Current << endl;
		Current++;
	}
	
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment