Skip to content

Instantly share code, notes, and snippets.

@anolson
Last active December 18, 2015 04:59
Show Gist options
  • Save anolson/5729449 to your computer and use it in GitHub Desktop.
Save anolson/5729449 to your computer and use it in GitHub Desktop.
Luhn Checksum

Luhn Checksum

Implement a Ruby program that outputs the validity of a number by applying the Luhn Checksum.

http://en.wikipedia.org/wiki/Luhn_algorithm

Please treat this as you would any other project or task you'd encounter during your daily work. This will show us how currently code, and not how you coded 6, 12 or 18 months ago. Your code should also be suitably tested.

Input:

The program should accept a single number to validate.

Output:

The program should output the input along with the validity of the number.

Examples:

With an input of 79927398713 the output should be:

79927398713 is valid.

With an input of 79927398710 the output should be:

79927398710 is not valid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment