- Joined
- Dec 17, 2022
- Messages
- 1
- Reaction score
- 0
#include"stdio.h"
#include"conio.h"
int fibo(int);
int main()
{
int a=0;
while(a!=10)
{
printf(" %d",fibo(a));
a++;
}
return 0;
}
int fibo(int a)
{
if(a==0)
{
return 0;
}
else if(a==1)
{
return 1;
}
else
{
return (fibo(a-1)+fibo(a-2));
}
}
This program calculates the Fibonacci series and displays it . But it displays the total sum of the series rather than the individual components of the series
#include"conio.h"
int fibo(int);
int main()
{
int a=0;
while(a!=10)
{
printf(" %d",fibo(a));
a++;
}
return 0;
}
int fibo(int a)
{
if(a==0)
{
return 0;
}
else if(a==1)
{
return 1;
}
else
{
return (fibo(a-1)+fibo(a-2));
}
}
This program calculates the Fibonacci series and displays it . But it displays the total sum of the series rather than the individual components of the series