12345678910111213141516171819202122232425262728293031323334353637383940
#include <iostream> using namespace std; int main() { int limit, fib[50]; cout << "enter limit: "; cin >> limit; for(int i=0; i<50; i++) { for (int i =0; i <50; i++) { if(i == 0) { fib[0] = 0; } else if(i ==1) { fib[1] = 0; } fib[i] = fib[i-1] + fib[i-2]; if(fib[i] >= limit) { break; } } if(fib[i] >= limit) { break; } cout << fib[i] << endl; } cout << endl; system ("pause"); return 0; }