#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int a,i,k,x;
printf("\n\tEnter the no. to print fibonic series");
scanf("%d",&a);
k=0;
printf("\n\t Fibonic series : 0, 1,");
for(i=1;i<a;)
{
x=k+i;
k=i;
i=x;
if(i<=a){
printf(" %d,",i);
}
}
getch();
}
No comments:
Post a Comment
Please write your doubts