Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
CF
SUBMITTED BY:
Guest
DATE:
Dec. 18, 2014, 7:20 p.m.
FORMAT:
Text only
SIZE:
391 Bytes
Raw
Download
Tweet
HITS:
1154
Go to comments
Report
#include <iostream>
using namespace std;
int main()
{
int n, i, a = 1, b = 1, c = 1;
cin >> n;
if ( n == 0) {
c = 0;
} else if ( n == 1 || n == 2){
c = 1;
} else {
for ( i = 2; i<n; i++){
c = a + b;
a = b;
b = c;
}
}
cout << c;
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus