#include<stdio.h>
#include<conio.h>
int Fibo(int n)
{
if(n==1||n==2)
return 1;
return (Fibo(n-1)+Fibo(n-2));
}
int main()
{
int n,i,sum=0;
printf("Enter number of term: \n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
sum=sum+Fibo(i);
}
printf("Sum of the series is: %d",sum);
getch();
return 0;
}
Enter number of term:
8
Sum of the series is: 54
--------------------------------
Process exited after 6.618 seconds with return value 0
Press any key to continue . . .