View Code of Problem 60

#include <iostream>
#include <cstdio>
using namespace std;
int main(){
    int t,k=1;
    cin>>t;
    while(t--){
        int n,a[999];
        cin>>n;
        a[1]=2,a[2]=3;
        for(int i=3;i<=n;i++){
            a[i]=a[i-1]+a[i-2];
        }
        if(t!=0){
        cout<<"Scenario #"<<k++<<":"<<endl;
        cout<<a[n]<<endl;
            cout<<endl;}
        else{
            cout<<"Scenario #"<<k++<<":"<<endl;
            cout<<a[n]<<endl;
        }
    }
    return 0;
}



Double click to view unformatted code.


Back to problem 60