View Code of Problem 610

#include <bits/stdc++.h>
using namespace std;
int main(){

    int n;
    int f[12];
    f[0]= 0;
    f[1] = 1;
    for(int i = 2 ; i<11; i++){
        f[i] = f[i-1]*2 + f[i-2];
    }
    while(cin>>n){
        cout<<f[n]<<endl;
    
    return 0;
}
/*
Main.cc: In function 'int main()':
Main.cc:16:1: error: expected '}' at end of input
 }
 ^
Main.cc:3:11: note: to match this '{'
 int main(){
           ^
*/

Double click to view unformatted code.


Back to problem 610