#include<stdio.h>
int fibo(int);
void main()
{
int digit,num;
clrscr();
printf("\nEnter number of elements in Fibonacci Series : ");
scanf("%d",&num);
for(digit=0;digit<num;digit++)
printf("%d\t",fibo(digit));
getch();
}
int fibo(int no)
{
if(no==0)
return 0;
if(no==1)
return 1;
return fibo(no-1)+fibo(no-2);
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.