Go: package main

import (
	"fmt"
)

func answer(n int) string {
	f := []int{1, 1}
	for i := 2; i <= n; i++ {
		f = append(f, f[i-1]+f[i-2])
	}

	return fmt.Sprintf("%d", f[n])
}

func main() {
	var n int
	fmt.Scan(&n)
	fmt.Println(answer(n))
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <random>
#include <map>

using namespace std;

int fibArray[50];

void makeFibArray() {
    for (int i = 2; i <= 46; i++) {
	fibArray[i] = fibArray[i - 1] + fibArray[i - 2];
    }
}

int main() {

    //cin.tie(0);
    //ios::sync_with_stdio(false);

    int n; scanf("%d", &n);
    fibArray[0] = 1;
    fibArray[1] = 1;
    makeFibArray();
    printf("%d", fibArray[n]);


    return 0;

}

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;

int main() {
  int n;
  cin >> n;
  ll dp[n];
  dp[0] = 1;
  dp[1] = 1;
  FOR(i, 2, n+1) {
    dp[i] = dp[i-1] + dp[i-2];
  }
  cout << dp[n] << endl;

  
  return 0;
}

C++: #include <iostream>
using namespace std;
int num;

int main(void) {
    cin >> num;
    int array[num] = {};
    array[0] = 1;
    array[1] = 1;
    for (int i= 2; i <= num; i++) array[i] = array[i - 1] + array[i - 2];
    cout << array[num] << endl;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <limits>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
#define reps(i, S, E) for (ll i = (S); i <= (E); i++)
#define rep(i, N) reps(i, 0, N-1)
#define deps(i, E, S) for (ll i = (E); i >= (S); i--)
#define dep(i, N) deps(i, N-1, 0)
const ll INF = 1LL << 60;
const int INF_INT = 1 << 30;

template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; }return false; }
struct mll {
	static ll MOD;
	ll val;
	mll(ll v = 0) : val(v % MOD) { if (val < 0) val += MOD; }
	mll operator - () const { return -val; }
	mll operator + (const mll &b) const { return val + b.val; }
	mll operator - (const mll &b) const { return val - b.val; }
	mll operator * (const mll &b) const { return val * b.val; }
	mll operator / (const mll &b) const { return mll(*this) /= b; }
	mll operator + (ll b) const { return *this + mll(b); }
	mll operator - (ll b) const { return *this - mll(b); }
	mll operator * (ll b) const { return *this * mll(b); }
	friend mll operator + (ll a, const mll &b) { return b + a; }
	friend mll operator - (ll a, const mll &b) { return -b + a; }
	friend mll operator * (ll a, const mll &b) { return b * a; }
	mll &operator += (const mll &b) { val = (val + b.val) % MOD; return *this; }
	mll &operator -= (const mll &b) { val = (val + MOD - b.val) % MOD; return *this; }
	mll &operator *= (const mll &b) { val = (val*b.val) % MOD; return *this; }
	mll &operator /= (const mll &b) {
		ll c = b.val, d = MOD, u = 1, v = 0;
		while (d) {
			ll t = c / d;
			c -= t * d; swap(c, d);
			u -= t * v; swap(u, v);
		}
		val = val * u % MOD;
		if (val < 0) val += MOD;
		return *this;
	}
	mll &operator += (ll b) { return *this += mll(b); }
	mll &operator -= (ll b) { return *this -= mll(b); }
	mll &operator *= (ll b) { return *this *= mll(b); }
	mll &operator /= (ll b) { return *this /= mll(b); }
	bool operator == (const mll &b) { return val == b.val; }
	bool operator != (const mll &b) { return val != b.val; }
	bool operator == (ll b) { return *this == mll(b); }
	bool operator != (ll b) { return *this != mll(b); }
	friend bool operator == (ll a, const mll &b) { return mll(a) == b.val; }
	friend bool operator != (ll a, const mll &b) { return mll(a) != b.val; }
	friend ostream &operator << (ostream &os, const mll &a) { return os << a.val; }
	friend istream &operator >> (istream &is, mll &a) { return is >> a.val; }
	static mll Combination(ll a, ll b) {
		chmin(b, a - b);
		if (b < 0) return mll(0);
		mll c = 1;
		rep(i, b) c *= a - i;
		rep(i, b) c /= i + 1;
		return c;
	}
};
using vmll = std::vector<mll>;
using vvmll = std::vector<vmll>;
using vvvmll = std::vector<vvmll>;
using vvvvmll = std::vector<vvvmll>;

struct Fast {
	Fast() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(std::numeric_limits<double>::max_digits10);
	}
} fast; //cin,cout高速化のおまじない＋桁数指定

ll mll::MOD = (ll)(1e9 + 7);// 998244353ll;



int main() {
	ll N;
	cin >> N;

	vll dp(N + 1, 0);
	dp[0] = 1;
	dp[1] = 1;

	reps(i, 2, N) {
		dp[i] = dp[i - 2] + dp[i - 1];
	}

	ll result = dp[N];

	cout << result << endl;

	return 0;
}

C++: #include<iostream>
#include <bits/stdc++.h>
#include<string>
#include<algorithm>
using namespace std;
typedef pair<int,int> P;


int main(){
    int N;
    cin >> N;
    int Nminus2=1, Nminus1 = 1,ans =0;
    if(N==0) cout <<1 <<endl;
    else if(N==1) cout <<1 <<endl;
    else {
        for(int i=1; i<N; ++i){
           ans = Nminus2 + Nminus1;
           Nminus2 =Nminus1;
           Nminus1 = ans;
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;

int main(void){
  int n;
  cin >> n;

  // n???0???1?????£?????????????????????
  if(n <= 1){ cout << 1 << endl; }
  else{
    // n???2??\????????£??????dp??????
    vector<int> dp(n + 1);
    dp[0] = dp[1] = 1;
    for(int i = 2; i <= n; i++)
      dp[i] = dp[i - 1] + dp[i - 2];

    cout << dp[n] << endl;
  }

  return 0;
}

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

class Fib {
public:
    Fib() : _f1(1), _f2(1) {}
    int operator()(int n) {
        if (n == 0) {
            return _f1;
        }
        if (n == 1) {
            return _f2;
        }
        else {
            for (int i = 2; i <=n; ++i) {
                double x = _f1 + _f2;
                _f1 = _f2;
                _f2 = x;
            }
            return _f2;
        }
    }

private:
    int _f1;
    int _f2;
    int _x;
};

int main() {
    int n;
    cin >> n;
    Fib f;
    cout << f(n) << endl;
}

C++: #include<stdio.h>
int main(void)
{
	int dp[1000]={0};
	int n,i;

	scanf("%d",&n);
	dp[0]=1;
	dp[1]=1;
	for(i=2;i!=n+1;i++){
		dp[i]=dp[i-1]+dp[i-2];
	}
	printf("%d\n",dp[n]);
}

C++: #include<stdio.h>
#define N 45
int main(){
    int F[N];
    int n,i;
    scanf("%d",&n);

    for(i=0;i<=n;i++){
        if(i==0 || i==1) F[i]=1;
        else F[i]=F[i-2]+F[i-1];
    }
    printf("%d\n",F[n]);
    return 0;
}