Skip to content

Commit 992582f

Browse files
Add files via upload
1 parent 09462b7 commit 992582f

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

Patterns/Pattern4.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
void pattern4(int n){
5+
for(int i = 1; i <= n; i++){
6+
for(int j = 1; j <= i; j++){
7+
cout << i << " ";
8+
}
9+
cout << endl;
10+
}
11+
}
12+
13+
int main(){
14+
pattern4(5);
15+
return 0;
16+
}

Patterns/Pattern5.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
void pattern5(int n){
5+
for(int i = 0; i < n; i++){
6+
for(int j = 0; j < n - i; j++){
7+
cout << "*";
8+
}
9+
cout << endl;
10+
}
11+
}
12+
13+
int main(){
14+
pattern5(5);
15+
return 0;
16+
}

Patterns/Pattern6.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
void pattern6(int n){
5+
for(int i = 1; i <= n; i++){
6+
for(int j = 1; j <= n - i + 1; j++){
7+
cout << j;
8+
}
9+
cout << endl;
10+
}
11+
}
12+
13+
int main(){
14+
pattern6(5);
15+
return 0;
16+
}

0 commit comments

Comments
 (0)