Friday, 24 January 2014

c program for fibonacci series

Q how to gernat fibonacci  series  in cprogramming

fibonacci series program  in c

#include<stdio.h>
int main()
{
int a,b,c,i,n;
a=0;
b=1;
fibonacci series program in cprintf("\n enter n for how many times generate series\n");
scanf("%d",&n);
printf("\n fibonacci series\n");
printf("%d%d",a,b);
for(i=0;i<n;i++)
{
    c=a+b;
    a=b;
    b=c;
    printf("\ %d",c);

}

}

No comments:

Post a Comment