Hi Guys I am fairly new to C++ and although I have been doing pretty well, I am now stuck on a certain code.
The problem given to us is stating :
Write a C++ Program that outputs the Fibonacci numbers that are less than a user specified value. Each Fibonacci number is the sum of its two predecessors. The first two Fibonacci numbers are are 1 and 1. Thus, the sequence begins with;
1, 1, 2, 3, 5, 8, 13, 21, 34, … and so on.
The program should keep asking the user for an upper limit and display the Fibonacci numbers that re less than that upper limit until the user enters an upper limit of 1 or less to quit
Output each Fibonacci number on a separate line.
I have been working on this for a while now and so far, this is what I have come up with. I know its not much, but I am trying my hardest to work on it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
int fib;
int fib1 = 0;
int fib2 = 1;
int fib3;
int number;
|
Now i understand what the problem is asking for, I just don't know how to program it...This is due tomm, in around 23 hours and I would like to turn it in
Thank You!