View Code of Problem 23

#include<bits/stdc++.h>
using namespace std;

int main() {
    long long a[90];
    a[0]=1;
    a[1]=2;
    for (int i = 2; i < 90; ++i) {
        a[i]=a[i-1]+a[i-2];
    }
    int m;
    while (cin>>m,m)
    {
        cout<<a[m-1]<<endl;
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 23