Thursday, November 17, 2016

Program to print fibonacci sequence

Here is the following code to print Fibonacci sequence.Hope this code will help a novice programmer.



#include<stdio.h>
#include<conio.h>
void main()
{
 int a,b,c,d,i;
a=1;
output
b=1;
printf("%6d",a);
printf("%6d",b);

for(i=1;i<=10;i++)
{
c=a+b;
d=b+c;
printf("%3d %3d",c,d);
a=c;
b=d;
}
getch();

}

No comments:

Post a Comment