// Fibonacci Sequence – Enter a number and have the program generate the Fibonacci sequence to that number or to the Nth number. #include <iostream> #include <cstring> int main() { using namespace std; const int kNum = 1000000; cout << "Enter a number: "; int number; cin >> number; cout << "The next number following the Fibonacci Sequence is: "; long double result = (1.619047619047 * number)+0.49; cout << static_cast<int> (result) << endl; int a; cin>>a; return 0; }

This seems to work, but try it entering " 1 " ...

How to avoid it? (without using loops)