HTML & JS
#include<bits/stdc++.h> 
using namespace std; 
#define NIL -1 
#define MAX 1000

long long lookup[MAX]; 

void fill() 
{ 
	memset(lookup, NIL, MAX * sizeof(lookup[0])); 
} 
long long fibo(int n) 
{ 
	if(lookup[n] == NIL) 
	{ 
		if(n <= 1) 
			lookup[n] = n; 
		else
			lookup[n] = fibo(n - 1) + fibo(n - 2); 
    } 
    return lookup[n]; 
} 
int main()
{ 
	int n; 
	cout<<"Enter n: ";
	cin>>n;
	fill();
	cout<<"Fibonacci number is "<<fibo(n); 
	return 0; 
} 

Generated URL:

Output:

Enter n: Fibonacci number is 32951280099
Report Bug