#include<stdio.h>
#include<conio.h>
void main()
{
int prev,next,count,last,n;
prev=0;
last=1;
printf("\n enter the total number of steps");
scanf("%d",&n);
printf("%d\t%d\t",prev,last);
for(count=1;count<=n-2;count++)/*n-2 becouse 2 steps are already filled*/
{
next=last+prev;
prev=last;
last=next;
printf("%d\t",next);
}
getch();
}
#include<conio.h>
void main()
{
int prev,next,count,last,n;
prev=0;
last=1;
printf("\n enter the total number of steps");
scanf("%d",&n);
printf("%d\t%d\t",prev,last);
for(count=1;count<=n-2;count++)/*n-2 becouse 2 steps are already filled*/
{
next=last+prev;
prev=last;
last=next;
printf("%d\t",next);
}
getch();
}
No comments:
Post a Comment