Create a program that displays the first 10 Fibonacci numbers (1, 1, 2, 3, 5, 8, 13,

Question:

Create a program that displays the first 10 Fibonacci numbers (1, 1, 2, 3, 5, 8, 13, 21, 34, and 55). Notice that beginning with the third number in the series, each Fibonacci number is the sum of the prior two numbers. For example, 2 is the sum of 1 plus 1, 3 is the sum of 1 plus 2, 5 is the sum of 2 plus 3, and so on. Write two versions of the code: one using the while statement, and the other using the for statement. If necessary, create a new project named Advanced26 Project, and save it in the Cpp8\Chap07 folder. Enter the C++ instructions into a source file named Advanced26.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Save and then run the program. The Fibonacci numbers should appear twice on the screen.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: