1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-19 22:19:29 +02:00

Add missing word (#2172)

This commit is contained in:
Andrew Walbran 2024-06-25 14:40:56 +01:00 committed by GitHub
parent 71d31410ed
commit f496303f2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,7 +10,7 @@ The [Luhn algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm) is used to
validate credit card numbers. The algorithm takes a string as input and does the validate credit card numbers. The algorithm takes a string as input and does the
following to validate the credit card number: following to validate the credit card number:
- Ignore all spaces. Reject number with fewer than two digits. - Ignore all spaces. Reject numbers with fewer than two digits.
- Moving from **right to left**, double every second digit: for the 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`. `1234`, we double `3` and `1`. For the number `98765`, we double `6` and `8`.
@ -23,7 +23,7 @@ following to validate the credit card number:
- The credit card number is valid if the sum ends with `0`. - The credit card number is valid if the sum ends with `0`.
The provided code provides a buggy implementation of the luhn algorithm, along The provided code provides a buggy implementation of the luhn algorithm, along
with two basic unit tests that confirm that most the algorithm is implemented with two basic unit tests that confirm that most of the algorithm is implemented
correctly. correctly.
Copy the code below to <https://play.rust-lang.org/> and write additional tests Copy the code below to <https://play.rust-lang.org/> and write additional tests