Question: Develop a code that inputs a string of 16 numbers as a string, not numbers. Then use str2num to convert the string numbers to real
Develop a code that inputs a string of 16 numbers as a string, not numbers. Then use str2num to convert the string numbers to real numbers as needed Some credit card numbers may be validated using the Luhn algorithm: The Luhn Formula: Drop the last digit from the number. The last digit is what we want to check against Reverse the numbers Multiply the digits in odd positions (1, 3, 5, etc.) by 2 and subtract 9 to all any result higher than 9 Add all the numbers together The check digit (the last number of the card) is the amount that you would need to add to get a multiple of 10 (Modulo 10), check your code with this number and your card number, but don't include your card number in the code please. Luhn Example: Step Total Original Number: s Drop the last digit: Reverse the digits: 4 s s 6 9 3 7 5 8 6 8 9 9 8 5 4 55 67 37 8 6 8 9 9 8 5 898 68 7 3 7 6 5 4 10 8 18 9 16 6 16 5 14 3 14 6 10 5 8 8 9 9 7 6 7 5 3 6 5 8 8 9 9 9 6 7 ss 356 38 Multiple odd digits by 2: Subtract 9 to numbers over 9: Add all numbers: Mod 10: 85 modulo 10 - 5 (last digit of card) Definition of modulo: a modulo bisc, it means that the remainder when a is divided by bisc
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
