forked from srbcheema1/Algo_Ds
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request srbcheema1#43 from geekychaser/master
Some patterns algo added. srbcheema1#4
- Loading branch information
Showing
6 changed files
with
182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main(){ | ||
|
||
int n; | ||
cin >> n; | ||
|
||
for( int i = 0; i < n; i++ ){ | ||
for( int j = 0; j < n; j++ ){ | ||
cout << "*"; | ||
} | ||
cout << endl; | ||
} | ||
return 0; | ||
|
||
} | ||
|
||
/* | ||
5 | ||
***** | ||
***** | ||
***** | ||
***** | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main(){ | ||
|
||
int n; | ||
cin >> n; | ||
|
||
for( int i = 0; i < n; i++ ){ | ||
for( int j = 0; j <= i; j++ ){ | ||
cout << "*"; | ||
} | ||
cout << endl; | ||
} | ||
|
||
return 0; | ||
|
||
} | ||
|
||
/* | ||
5 | ||
* | ||
** | ||
*** | ||
**** | ||
***** | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main(){ | ||
|
||
int n; | ||
cin >> n; | ||
|
||
for( int i = n; i > 0; i-- ){ | ||
for( int j = 0; j < i; j++ ){ | ||
cout << "*"; | ||
} | ||
cout << endl; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
/* | ||
5 | ||
***** | ||
**** | ||
*** | ||
** | ||
* | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main(){ | ||
|
||
int n; | ||
cin >> n; | ||
|
||
for( int i = 0; i < n; i++ ){ | ||
for( int j = 0; j <= i; j++ ){ | ||
cout << "*"; | ||
} | ||
cout << endl; | ||
} | ||
|
||
for( int i = n-1; i > 0; i-- ){ | ||
for( int j = 0; j < i; j++ ){ | ||
cout << "*"; | ||
} | ||
cout << endl; | ||
} | ||
|
||
return 0; | ||
|
||
} | ||
|
||
/* | ||
5 | ||
* | ||
** | ||
*** | ||
**** | ||
***** | ||
**** | ||
*** | ||
** | ||
* | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main(){ | ||
|
||
int n; | ||
cin >> n; | ||
|
||
for( int i = 1; i <= n; i++ ){ | ||
for( int j = 1; j <= i; j++ ){ | ||
cout << i; | ||
} | ||
cout << endl; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
/* | ||
5 | ||
1 | ||
22 | ||
333 | ||
4444 | ||
55555 | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main(){ | ||
int n; | ||
cin >> n; | ||
|
||
int count = 1; | ||
for( int i = 0; i < n; i++ ){ | ||
for( int j = 0; j <= i; j++ ){ | ||
cout << count << " "; | ||
count++; | ||
} | ||
cout << endl; | ||
} | ||
return 0; | ||
|
||
} | ||
|
||
/* | ||
5 | ||
1 | ||
2 3 | ||
4 5 6 | ||
7 8 9 10 | ||
11 12 13 14 15 | ||
*/ |