Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func fib(n int) int {
	x, y := 1, 1
	for n > 0 {
		x, y = y, x+y
		n--
	}
	return x
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}
	fmt.Println(fib(n))
}

func nextText(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) (int, error) {
	return strconv.Atoi(nextText(sc))
}

C++: #include<iostream>
#include<algorithm>


using namespace std;


int main()
{
	int n;
	int a[45] = { 1,1 };
	ios::sync_with_stdio(false);

	cin >> n;

	for (int i = 2; i < n+1; ++i)
	{
		a[i] = a[i - 1] + a[i - 2];
	}

	cout << a[n] << endl;

	return 0;

}

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

int FibonacciNumber(int n) {

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

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

	cout << FibonacciNumber(n) <<endl;
	
}

C++: #include<cstdio>

const int maxn = 44 + 1;
int a[maxn];

int calcFibonacciNumber(int n) {
    if (n < 0) {
        return 0;
    }
    if (n == 0 || n == 1) {
        return 1;
    }
    if (a[n] != -1) {
        return a[n];
    }
    a[n] = calcFibonacciNumber(n - 1) + calcFibonacciNumber(n - 2);
    return a[n];
}

int getFibonacciNumber(int n) {
    return calcFibonacciNumber(n);
}

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < maxn; i++) {
        a[i] = -1;
    }
    printf("%d\n", getFibonacciNumber(n));
    return 0;
}

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

long long fibodp(int n){
    long long fibodp[200]={0};
    fibodp[0]=1;
    fibodp[1]=1;
    for(int i=2; i<=n; i++){
        fibodp[i]=fibodp[i-1]+fibodp[i-2];
    }
    return fibodp[n];
}

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

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };

#define MAX 3000000 
char s[MAX + 10];
int wSum[MAX + 10];
int eSum[MAX + 10];

int dp[45];

int fibo(int n) {
	if (n == 0 || n == 1) 
		return dp[n] = 1;
	if (dp[n] != -1)
		return dp[n];
	return dp[n] = fibo(n - 2) + fibo(n - 1);
}

signed main() {
	ios::sync_with_stdio(false);
	int i, n;
	cin >> n;
	rep(i, 45) dp[i] = -1;
	cout << fibo(n) << "\n";
	return 0;
}

C++: #include <bits/stdc++.h>
int N;

int fib() {
    int arr[N+1];
    arr[0] = 0; arr[1] = 1;

    for (int i = 2; i <= N+1; i++) {
        arr[i] = arr[i-1] + arr[i-2];
    }
    return arr[N+1];
}


int main() {

    std::scanf("%d", &N);
    std::printf("%d\n", fib());

}

C++: #include<algorithm>
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
#define MAX 45
int F[MAX];


int fibonacci(int i){
    if(i == 1 || i == 0) return F[i] = 1;
    if(F[i]) return F[i];
    return F[i] = fibonacci(i-1) + fibonacci(i-2);
}

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

    cout << F[n] << endl;

    return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <cstring>
#include <cstdio>
#include <cmath>
 
using namespace std;
 
int f(const int);
 
int main()
{
    int N;
    int num=1,old[2]={1,1};
    cin>>N;
    for(int i=1;i<N;i++){
        num=old[0]+old[1];
        old[0]=old[1];
        old[1]=num;
    }
    cout<<num<<endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
long long dp[50];
long long fib(int n){
if (n<=1) return 1;
if (dp[n]) return dp[n];
return dp[n]=fib(n-1)+fib(n-2);
}
int main(){
int n; cin>>n; cout<<fib(n)<<endl;
}