Write a Program in C to find the Sum of Fibonacci Series

#include <stdio.h>
#include <conio.h>
void main()
{
int i,n,a=1,b=0,c,s=0;
printf("\nEnter the limit:");
scanf("%d", &n);
for (i=1;i<=n;i++)
{
c=a+b;
a=b;
b=c;
s=s+c;
}
printf("\nThe Sum the fibonnaci series is: %d", s);
getch();
}
Comments
Post a Comment