C program to print a Fibonacci series

      No Comments on C program to print a Fibonacci series
#include<stdio.h>
#include<conio.h>
void main()
{
int x=0,y=1,z,i,n;
clrscr();
printf("Enter no. of digits you want to find fibonacci series:-\n");
scanf("%d",&z);
printf("Fibonacci series is:-\n");
for(i=0;i<=z;i++)
{
 printf("%d ",x);
 n=x+y;
 x=y;
 y=n;
}
 getch();
}

OUTPUT:-

Leave a Reply

Your email address will not be published. Required fields are marked *