subject

The Luhn algorithm is used to check bank card numbers for simple errors such as mistyping a digit, and proceeds as follows: consider each digit as a separate number; moving left, double every other number from the second last; subtract 9 from each number that is now greater than 9; add all the resulting numbers together; if the total is divisible by 10, the card number is valid. Define a function luhnDouble :: Int -> Int that doubles a digit and subtracts 9 if the result is greater than 9. For example: > luhnDouble 3 6 > luhnDouble 6 3 Using luhnDouble and the integer remainder function mod, define a function luhn :: Int -> Int -> Int -> Int -> Bool that decides if a four-digit bank card number is valid. For example: > luhn 1 7 8 4 True > luhn 4 7 8 3 False

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 09:30
My mom and i are moving and we don’t have wifi for the next week, i want to know if using a using a hotspot with unlimited data is better than using regular wifi. i’m considering cost, speed, and data sacrifices.
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
How many points do i need before i can send a chat
Answers: 1
question
Computers and Technology, 24.06.2019 18:30
Jacking is a crime that takes place when a hacker misdirects url to a different site. the link itself looks safe, but the user is directed to an unsafe page
Answers: 1
question
Computers and Technology, 25.06.2019 04:30
Consider a list of full names formatted “firstname lastname”, like ["jules verne", "alexandre dumas", "maurice druon"]. write a list comprehension that produces a list with the full names in the format “lastname, firstname”. the resulting list should look like ['verne, jules', 'dumas, alexandre', 'druon, maurice']. the simplest solution may involve a nested comprehension: [ …. for … in [ … for … in … ]].
Answers: 3
You know the right answer?
The Luhn algorithm is used to check bank card numbers for simple errors such as mistyping a digit, a...
Questions
question
Biology, 04.03.2020 02:33
question
History, 04.03.2020 02:33
Questions on the website: 13722359