===========================================================================
CODING
#include<all.h>
void main()
{
clrscr();
int a,b,i,c,n;
cout<<"Enter no.: ";
cin>>n;
for(i=1,a=1,b=1;i<=n;i++)
{
if(i==1)
cout<<a<<" "<<b;
c=a+b;
cout<<" "<<c;
a=b;
b=c;
}
getch();
}
CODING
#include<all.h>
void main()
{
clrscr();
int a,b,i,c,n;
cout<<"Enter no.: ";
cin>>n;
for(i=1,a=1,b=1;i<=n;i++)
{
if(i==1)
cout<<a<<" "<<b;
c=a+b;
cout<<" "<<c;
a=b;
b=c;
}
getch();
}
===========================================================================
No comments:
Post a Comment