-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync the
raindrops
exercise's docs with the latest data. (#687)
- Loading branch information
1 parent
be2dfe4
commit faeb9ee
Showing
2 changed files
with
18 additions
and
11 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 |
---|---|---|
@@ -1,20 +1,24 @@ | ||
# Instructions | ||
|
||
Your task is to convert a number into a string that contains raindrop sounds corresponding to certain potential factors. | ||
A factor is a number that evenly divides into another number, leaving no remainder. | ||
The simplest way to test if one number is a factor of another is to use the [modulo operation][modulo]. | ||
Your task is to convert a number into its corresponding raindrop sounds. | ||
|
||
The rules of `raindrops` are that if a given number: | ||
If a given number: | ||
|
||
- has 3 as a factor, add 'Pling' to the result. | ||
- has 5 as a factor, add 'Plang' to the result. | ||
- has 7 as a factor, add 'Plong' to the result. | ||
- _does not_ have any of 3, 5, or 7 as a factor, the result should be the digits of the number. | ||
- is divisible by 3, add "Pling" to the result. | ||
- is divisible by 5, add "Plang" to the result. | ||
- is divisible by 7, add "Plong" to the result. | ||
- **is not** divisible by 3, 5, or 7, the result should be the number as a string. | ||
|
||
## Examples | ||
|
||
- 28 has 7 as a factor, but not 3 or 5, so the result would be "Plong". | ||
- 30 has both 3 and 5 as factors, but not 7, so the result would be "PlingPlang". | ||
- 34 is not factored by 3, 5, or 7, so the result would be "34". | ||
- 28 is divisible by 7, but not 3 or 5, so the result would be `"Plong"`. | ||
- 30 is divisible by 3 and 5, but not 7, so the result would be `"PlingPlang"`. | ||
- 34 is not divisible by 3, 5, or 7, so the result would be `"34"`. | ||
|
||
~~~~exercism/note | ||
A common way to test if one number is evenly divisible by another is to compare the [remainder][remainder] or [modulus][modulo] to zero. | ||
Most languages provide operators or functions for one (or both) of these. | ||
[remainder]: https://exercism.org/docs/programming/operators/remainder | ||
[modulo]: https://en.wikipedia.org/wiki/Modulo_operation | ||
~~~~ |
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,3 @@ | ||
# Introduction | ||
|
||
Raindrops is a slightly more complex version of the FizzBuzz challenge, a classic interview question. |