mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2024-12-08 00:45:29 +01:00
feat(challenges): add print-pyramid
This commit is contained in:
parent
b824619dd9
commit
b0d90e03bc
50
challenges/print-pyramid/README.md
Normal file
50
challenges/print-pyramid/README.md
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# print-pyramid
|
||||||
|
|
||||||
|
Created by [@Divlo](https://github.com/Divlo) on 21 September 2021.
|
||||||
|
|
||||||
|
## Instructions
|
||||||
|
|
||||||
|
Display a pyramid of stars (`*`) whose height is given and in the right order (`normal` or `reverse`).
|
||||||
|
|
||||||
|
### Input
|
||||||
|
|
||||||
|
- **Line 1:** The string : `normal` or `reverse` to determine how to show the pyramid.
|
||||||
|
- **Line 2:** The integer : height of the pyramid.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
See the `test` folder for examples of input/output.
|
||||||
|
|
||||||
|
### Example 1
|
||||||
|
|
||||||
|
#### Input
|
||||||
|
|
||||||
|
```txt
|
||||||
|
normal
|
||||||
|
3
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Output
|
||||||
|
|
||||||
|
```txt
|
||||||
|
*
|
||||||
|
***
|
||||||
|
*****
|
||||||
|
```
|
||||||
|
|
||||||
|
### Example 2
|
||||||
|
|
||||||
|
#### Input
|
||||||
|
|
||||||
|
```txt
|
||||||
|
reverse
|
||||||
|
3
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Output
|
||||||
|
|
||||||
|
```txt
|
||||||
|
*****
|
||||||
|
***
|
||||||
|
*
|
||||||
|
```
|
0
challenges/print-pyramid/solutions/.gitkeep
Normal file
0
challenges/print-pyramid/solutions/.gitkeep
Normal file
2
challenges/print-pyramid/test/1/input.txt
Normal file
2
challenges/print-pyramid/test/1/input.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
normal
|
||||||
|
3
|
3
challenges/print-pyramid/test/1/output.txt
Normal file
3
challenges/print-pyramid/test/1/output.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
*
|
||||||
|
***
|
||||||
|
*****
|
2
challenges/print-pyramid/test/2/input.txt
Normal file
2
challenges/print-pyramid/test/2/input.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
reverse
|
||||||
|
3
|
3
challenges/print-pyramid/test/2/output.txt
Normal file
3
challenges/print-pyramid/test/2/output.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
*****
|
||||||
|
***
|
||||||
|
*
|
2
challenges/print-pyramid/test/3/input.txt
Normal file
2
challenges/print-pyramid/test/3/input.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
normal
|
||||||
|
8
|
8
challenges/print-pyramid/test/3/output.txt
Normal file
8
challenges/print-pyramid/test/3/output.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
*
|
||||||
|
***
|
||||||
|
*****
|
||||||
|
*******
|
||||||
|
*********
|
||||||
|
***********
|
||||||
|
*************
|
||||||
|
***************
|
2
challenges/print-pyramid/test/4/input.txt
Normal file
2
challenges/print-pyramid/test/4/input.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
reverse
|
||||||
|
8
|
8
challenges/print-pyramid/test/4/output.txt
Normal file
8
challenges/print-pyramid/test/4/output.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
***************
|
||||||
|
*************
|
||||||
|
***********
|
||||||
|
*********
|
||||||
|
*******
|
||||||
|
*****
|
||||||
|
***
|
||||||
|
*
|
2
challenges/print-pyramid/test/5/input.txt
Normal file
2
challenges/print-pyramid/test/5/input.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
normal
|
||||||
|
9
|
9
challenges/print-pyramid/test/5/output.txt
Normal file
9
challenges/print-pyramid/test/5/output.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
*
|
||||||
|
***
|
||||||
|
*****
|
||||||
|
*******
|
||||||
|
*********
|
||||||
|
***********
|
||||||
|
*************
|
||||||
|
***************
|
||||||
|
*****************
|
2
challenges/print-pyramid/test/6/input.txt
Normal file
2
challenges/print-pyramid/test/6/input.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
reverse
|
||||||
|
9
|
9
challenges/print-pyramid/test/6/output.txt
Normal file
9
challenges/print-pyramid/test/6/output.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
*****************
|
||||||
|
***************
|
||||||
|
*************
|
||||||
|
***********
|
||||||
|
*********
|
||||||
|
*******
|
||||||
|
*****
|
||||||
|
***
|
||||||
|
*
|
Loading…
Reference in New Issue
Block a user