Pages

Saturday, 19 May 2012

program to print this Fibonacci Series


37./*Write a program to print this Fibonacci Series :-
          0,1,1,2,3,5,8,13,21,34

#include<stdio.h>
#include<conio.h>
main()
{
int x=0,y=1,z=0;
int i;
clrscr();
for(i=0;i<10;i++)
{
printf("%d,",z);
x=y;
y=z;
z=x+y;
}
getch();
}


OUTPUT
            0,1,1,2,3,5,8,13,21,34

No comments:

Post a Comment