Go: // AOJ ALDS1_10_A: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A

package main

import (
	"fmt"
)

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

func main() {
	var n int
	fmt.Scanf("%d", &n)
	fmt.Println(fibonacci(n))
}

C++: #include<stdio.h>
#include<queue>
#include<algorithm>
using namespace std;
int a[100];
int main(){
int n;
a[1]=1;
a[2]=1;
scanf("%d",&n);
  for (int i=3;i<=n+1;i++)
    a[i]=a[i-1]+a[i-2];
    printf("%d\n",a[n+1]);
return 0;}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

// DP
int n; 
vector<ll> dp;
ll fibo(int i) {
  dp[0] = 1; dp[1] = 1;
  for(int i = 2; i <= n; ++i) {
    dp[i] = dp[i - 1] + dp[i - 2];
  }
  return dp[n];
}

int main() {
  cin >> n; dp.resize(100);
  cout << fibo(n) << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    n++;
    vector<ll> dp(n);
    dp[0] = 1; dp[1] = 1;
    rep(i, n - 2) {
        dp[i + 2] = dp[i] + dp[i + 1];
    }
    cout << dp[n - 1] << endl;
    return 0;
}

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


int fibonacci(int n)
{
    if (n == 0 || n == 1)
    {
        return 1;
    }
    else
    {
        return fibonacci(n-1) + fibonacci(n-2);
    }
}

int main()
{
    int C;

    cin >> C;

    cout << fibonacci(C) << endl;

    return 0;
}

C++: #include "bits/stdc++.h"

using namespace std;

int main (){
	int n;
	cin >> n;
	int a[44];
	a[0] = 1;
	a[1] = 1;
	for (int i = 2;i<=n;i++){
		a[i] = a[i - 1] + a[i - 2];
	}
	cout << a[n - 1]<<endl;

	return 0;
}

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

static const int maxn=44;

int DP[45];

int Fibonacci(int n) {
  if (n==0 or n==1) 
    return DP[n]=1;
  
  if (DP[n]!=(-1)) 
    return DP[n];
  
  return DP[n]=Fibonacci(n-1)+Fibonacci(n-2);
}
int main() {
  std::ios::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  memset(DP,(-1),sizeof(DP));
  Fibonacci(maxn);
  int n;
  cin>>n;
  cout<<DP[n]<<endl;
  return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
using namespace std;
#define MAX 44

int F[MAX];

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

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

int main(){
  int n;
  cin >> n;
  int fn[50];
  fn[0] = fn[1] = 1;
  for(int i = 2; i <= n; i++) fn[i] = fn[i - 1] + fn[i - 2];

  cout << fn[n] << end;
  }
  return 0
}

C++: #include<iostream>
using namespace std;
int main(){
    int i,a;
    int A[50];
    cin>>a;
    A[0]=A[1]=1;
    for(i=2;i<=a;i++) A[i]=A[i-1]+A[i-2];
    cout<<A[a]<<endl;
    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cctype>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <memory>
#include <functional>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i <= n; i++) //変数,初期値,終値
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int dp;
int memo;
int fib(int n);

int main(void)
{
    int n;
    int ans=0;
    cin >> n;
    ans = fib(n);
    
    cout << ans << endl;
    
    return 0;
}
int fib(int n)
{
    if(n==0 || n==1)return 1;
    else return fib(n-1)+fib(n-2);
}

C++: #include<iostream>
using namespace std;
int main() {
	long long l[44];
	l[0] = 1;
	l[1] = 1;
	for (int i = 2; i < 44; i++)
	{
		l[i] = l[i - 2] + l[i - 1];
	}
	int n;
	cin >> n;
	cout << l[n];
	char c;
	cin >> c;
}

C++: #include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

int fib(int n) {
	if (n <= 1)
		return 1;
	return fib(n-1) + fib(n-2);
}

int main() {
	int n;
	cin >> n;
	cout << fib(n) << endl;
	return 0;
}

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

int main(){
    int f[44],n;
    cin>>n;
    f[0]=1;f[1]=1;
    for(int i=2;i<45;i++){
        f[i]=f[i-1]+f[i-2];
    }
    cout<<f[n-1]<<endl;
    return 0;
}

C++: /*
 * C言語のサンプルプログラム - Webkaru
 * - フィボナッチ数の計算 -
 */
#include <stdio.h>
 
int main(void)
{
  /* 変数の宣言 */
  int n;
  int f0, f1, f2;
 
  f0 = 0;
  f1 = 1;
  scanf("%d",&n);
 
  /* フィボナッチ数の計算 */
  while(f1<100000) {
    // フィボナッチ数の計算
    f2 = f1 + f0;
    if(f0==n)printf("%d\n",f2);
    // 変数の代入
    f0 = f1;
    f1 = f2;
  }
 
  return 0;
}

C++: #include<iostream>

using namespace std;

int main(void){

int n,fib[45];
fib[0]=fib[1]=1;

for(int i=2;i<45;i++)fib[i]=fib[i-1]+fib[i-2];

while(cin >> n)cout << fib[n]<<endl;

return 0;
}

C++: #include<iostream>

using namespace std;
int fib(int n);

int memo[45];
int main(){
  int n;
  cin >> n;
  cout << fib(n) << endl;
  retrun 0;
}

int fib(int n){
  
  if(n==0){
    return 1;
  }else if(n==1){
    return 1;
  }
  else if(memo[n] !=0){
    return memo[n];
  }else{
    return memo[n]=fib(n-1)+fib(n-2);
  }
  
}

C++: // フィボナッチ数列
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

#define MAX_N 44
// 無効な値の定義
const int INV = -1;

// フィボナッチ数列を保持する配列
int fib[MAX_N];

int Fibonacci(int n);

int main(void)
{

    int n;

    cin >> n;

    for(int i = 0; i < MAX_N; i++)
    {
        fib[i] = INV;
    }

    fib[0] = 1;
    fib[1] = 1;

    // フィボナッチ数列の表示
    printf("%d\n", Fibonacci(n));

    return 0;
}

// フィボナッチ数列を算出する関数
int Fibonacci(int n)
{
    if( n <= 1)
    {
        // n = 0, n = 1 の時
        return 1;
    }

    if( fib[n] != INV )
    {
        // 既に計算されている時は, 結果を返す
        return fib[n];
    }

    return Fibonacci(n - 1) + Fibonacci(n - 2);
}

C++: # include <bits/stdc++.h>
# define range_for(i, b, e) for(int i=(b), i##_len=(e); i<i##_len; ++i)
using namespace std;
void _cin(){}
template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
#define Cin(Type, ...) Type __VA_ARGS__; _cin(__VA_ARGS__)

static const int n_max = 44;
int fib[n_max + 1];

int main()
{
    Cin(int, n);

    fib[0] = fib[1] = 1;
    range_for (i, 2, n+1)
    {
        fib[i] = fib[i-1] + fib[i-2];
    }

    cout << fib[n] << endl;

    return 0;
}