#include
#include
void main()
{
int a,i; long int p,q,d,sum=2;
clrscr();
printf("How many fibonaci element you want: ");
scanf("%d",&a);
p=1;q=1;
printf("\nFibonaci serrise with %d element :",a);
printf("%ld %ld ",p,q);
for(i=2;i
{
d=p+q;
p=q;
q=d;
printf("%ld ",d);
sum=sum+d;
}
printf("\n\nThe summation of fibonaciseries up to %d term=%d",a,sum);
getch();
}
0 comments:
Post a Comment