#include<stdio.h>
#include<conio.h>
int main()
{
int m=0,n=1,temp,a;
printf("enter the value upto which you want to print fibonacci numbers\n");
scanf("%d",&a);
printf("%d\n%d\n",m,n);
while(n<a)
{
temp=m;
m=n;
n=temp+n;
while(n<a)
{
printf("%d\n",n);
break;
}
}
_getch();
return 0;
}
#include<conio.h>
int main()
{
int m=0,n=1,temp,a;
printf("enter the value upto which you want to print fibonacci numbers\n");
scanf("%d",&a);
printf("%d\n%d\n",m,n);
while(n<a)
{
temp=m;
m=n;
n=temp+n;
while(n<a)
{
printf("%d\n",n);
break;
}
}
_getch();
return 0;
}
No comments:
Post a Comment