Skip to content

Commit 015ec68

Browse files
authored
Add files via upload
1 parent 63cb4ef commit 015ec68

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* Coding Blocks Hacker Blocks*/
2+
/* Title - FIBONACCI PATTERN (PATTERN 4) */
3+
//Take N (number of rows), print the following pattern (for N = 4)
4+
//0
5+
//1 1
6+
//2 3 5
7+
//8 13 21 34
8+
#include<iostream>
9+
using namespace std;
10+
int main() {
11+
int a=0,b=1,c,n;
12+
cin>>n;
13+
for(int i=1;i<=n;i++)
14+
{
15+
for(int k=1;k<=i;k++)
16+
{
17+
cout<<a<<" ";
18+
c=a+b;
19+
a=b;
20+
b=c;
21+
}
22+
cout<<endl;
23+
}
24+
return 0;
25+
}

0 commit comments

Comments
 (0)