#include<iostream.h>
#include<conio.h>
main()
{
int a, b, c, n;
a=0;
b=1;
c=0;
int i=0;
clrscr();
cout<<"Enter the value of n";
cin>>n;
cout<<'\n'<<a<<'\n'<<b;
for(i=2;i<n;i++)
{
c=a+b;
cout<<'\n'<<c;
a=b;
b=c;
}
getch();
}
#include<conio.h>
main()
{
int a, b, c, n;
a=0;
b=1;
c=0;
int i=0;
clrscr();
cout<<"Enter the value of n";
cin>>n;
cout<<'\n'<<a<<'\n'<<b;
for(i=2;i<n;i++)
{
c=a+b;
cout<<'\n'<<c;
a=b;
b=c;
}
getch();
}
No comments:
Post a Comment