Here is what I'm suppose to do:
By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two; for example, the first 6 Fibonacci numbers are 0, 1, 1, 2, 3, 5. Write a program that asks the user for a number between 5 and 20 (inclusive) and then displays that many Fibonacci numbers. You must use a loop to calculate this! Don’t just cout the answer for each of the 15 possible answers. Also: Note that there is no last comma in the list.
#include <iostream>
#include <cstdlib>
usingnamespace std;
int main(){
int x = 0;
int fibNum = 0;
cout << "How many Fibonacci numbers do you want? <5 to 20>: ";
cin >> fibNum;
while(x <= fibNum){
x = x +1;
cout << x << ", ";
}
return 0;
}