#include <stdio.h>
#include <conio.h>
#include <process.h>
void main()
{
int var1,var2,i,var3=0,var4=1;
clrscr();
printf("No of terms to display\t");
scanf("%d",&var1);
if(var1==1)
{
printf("%d",var4);
getch();
exit(0);
}
else
printf("%d\n",var4);
for( i=1;i<=(var1-1);i++)
{
var2=var3;
var3=var4;
var4=var2+var3;
printf("%d\n",var4);
}
getch();
}
#include <conio.h>
#include <process.h>
void main()
{
int var1,var2,i,var3=0,var4=1;
clrscr();
printf("No of terms to display\t");
scanf("%d",&var1);
if(var1==1)
{
printf("%d",var4);
getch();
exit(0);
}
else
printf("%d\n",var4);
for( i=1;i<=(var1-1);i++)
{
var2=var3;
var3=var4;
var4=var2+var3;
printf("%d\n",var4);
}
getch();
}
0 comments :
Post a Comment