CODE:
#include<iostream>
using namespace std;
main()
{
int n,x=0,y=1;
cout<<"Enter the n value:";
cin>>n;
for(int i=0;i<n;i++)
{
cout<<x<<endl;
cout<<y<<endl;
x=x+y;
y=x+y;
}
}
OUTPUT:
D:\c programes\mypractice>a.exe
Enter the n value:15
0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
10946
17711
28657
46368
75025
121393
196418
317811
514229
No comments:
Post a Comment