In: Computer Science
/* The following function illustrate storing of values in 2d array using recursion*/
#include<iostream>
using namespace std;
int fib(int n)
{
if (n <= 1)
return n;
return fib(n-1) + fib(n-2);
}
int main ()
{
int n = 9,i1=0;
int a[3][3];
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
a[i][j]=fib(i1);
i1++;
}
}
return 0;
}