#include<stdio.h>
int anik(int a)
{
if(a == 0)
{
return 0;
}
else if(a == 1)
{
return 1;
}
else
{
return (anik(a-1) + anik(a-2));
}
}
int main()
{
int n, i, j = 0;
printf("Enter any number : ");
scanf("%d", &n);
printf("\n");
for(i=1;i<=n;i++)
{
printf("%d ", anik(j));
j++;
}
printf("\n");
return 0;
}
int anik(int a)
{
if(a == 0)
{
return 0;
}
else if(a == 1)
{
return 1;
}
else
{
return (anik(a-1) + anik(a-2));
}
}
int main()
{
int n, i, j = 0;
printf("Enter any number : ");
scanf("%d", &n);
printf("\n");
for(i=1;i<=n;i++)
{
printf("%d ", anik(j));
j++;
}
printf("\n");
return 0;
}
Comments
Post a Comment