Fibonacci Sequence (remember this?!?)

0 1 1 2 3 5 8 13 ...

Write the C++ code (using at least one while loop) to gather a positive number from the user and then calculate and print that many Fibonacci numbers to the screen!

Additional Challenges:

  1. Validate the user's input to ensure that they entered a positive number.
  2. Move to a new line after every 10th Fibonacci number!
  3. Start the process over again as long as the user enters 'Y' or 'y' to continue.


  • Use your favorite online compiler to run and test your code!
  • Write all of your team members' names in the comments at the top of your program.
  • Copy and paste the link for your successful code HERE (023) or HERE (022)!

Online C++ Compilers and Pasting Sites (make sure to select C++ as your language):