I wrote this program, and when it generates 50 or so numbers, it starts making them negative. Any ideas why?
Code:#include <iostream> using namespace std; int fibonacci(int n); int main() { cout << "Ryan's Fibonacci Number calculator.\n"; int input; while(input != 0) { if(input == 0) break; cout << "Enter how many Fibonacci Numbers to calculate.\nEnter 0 to quit: "; cin >> input; fibonacci(input); } } int fibonacci(int n) { int first = 0; int second = 1; while(n--) { cout << first << "\n"; int tmp = first+second; first = second; second = tmp; } }