forked from root/public
Compare commits
5 Commits
master
...
1140-ping-
Author | SHA1 | Date |
---|---|---|
estlop | f6e0c8fa9d | 2 years ago |
estlop | 6c40cf46a0 | 2 years ago |
estlop | 862c5274dd | 2 years ago |
estlop | 1bf2a197c5 | 2 years ago |
estlop | 1b381e0314 | 2 years ago |
1 changed files with 24 additions and 0 deletions
@ -0,0 +1,24 @@ |
|||||||
|
## pingpong |
||||||
|
|
||||||
|
### Instructions |
||||||
|
|
||||||
|
Write a program that checks if all numbers up to a given number are odd or even. |
||||||
|
The numbers will be between 0 and 100. |
||||||
|
|
||||||
|
- If the number is odd then it prints the number and `pong` as in the example below. |
||||||
|
- If the number is even then it prints the number and `ping` in the same way. |
||||||
|
- If the number of arguments is invalid then do nothing. |
||||||
|
|
||||||
|
### Usage |
||||||
|
|
||||||
|
```console |
||||||
|
$ go run . 6 | cat -e |
||||||
|
0 ping$ |
||||||
|
1 pong$ |
||||||
|
2 ping$ |
||||||
|
3 pong$ |
||||||
|
4 ping$ |
||||||
|
5 pong$ |
||||||
|
$ go run . | cat -e |
||||||
|
$ |
||||||
|
``` |
Loading…
Reference in new issue