Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* 0 1 1 2 3 5 8 13 21 34 55 89 ... */
- #include <iostream>
- using namespace std;
- main ()
- {
- int m, n, a[50];
- cin >> n;
- a[0]=0; a[1]=1;
- for (int i=2; i<n; i++)
- {
- a[i]=a[i-1] + a[i-2];
- m = a[i];
- }
- cout << m << endl;
- system ("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment