mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-28 13:17:35 +02:00
Corrected Luhn's Algorithm Step 3 (#1194)
In the exercise guideline for the Luhn's algorithm (Day 1, Afternoon exercise), I made a correction to step 3 to provide a more accurate explanation. Instead of stating that doubling 7 becomes 14, I clarified that doubling 7 results in 14, and we should sum the individual digits of 14 to get the correct value of 5.
This commit is contained in:
parent
fb95f779d2
commit
354f3afa7c
@ -9,8 +9,8 @@ following to validate the credit card number:
|
||||
* Moving from **right to left**, double every second digit: for the number `1234`,
|
||||
we double `3` and `1`. For the number `98765`, we double `6` and `8`.
|
||||
|
||||
* After doubling a digit, sum the digits. So doubling `7` becomes `14` which
|
||||
becomes `5`.
|
||||
* After doubling a digit, sum the digits if the result is greater than 9. So doubling `7` becomes `14` which
|
||||
becomes `1 + 4 = 5`.
|
||||
|
||||
* Sum all the undoubled and doubled digits.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user