Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- using namespace std;
- int main()
- {
- // freopen("input.txt, "r", stdin);
- // freopen("output.txt, "r", stdout);
- int N;
- int a[50];
- a[0] = 0;
- a[1] = 1;
- cin>>N;
- for (int i = 2; i<=N; i++) {
- a[i] = a[i-1] + a[i-2];
- }
- cout<<a[N];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment