for Robot Artificial Inteligence

17.Dynamic Programming - Fibonachi

|

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int fibonachi(int x)
{
    int y;
    if (x==0)
        return 0;
    if (x==1)
        return 1;
    if (x==2)
        return 1;
    y = (x-2)+(x-1);
    return y;
}
int main()
{
    int k = 5;

    int result = fibonachi(k);

    cout<<result;

    return 0;
}

Comments