0

I'm having my issues finding the right answer as this is non code related.

The checksum says: "If the total’s last digit is 0, the number is valid!"

This is a credit card number that is supposed to be valid: 4012 8888 8888 1881

The 16 digits are legit. But as you see in the picture, the checksum doesn't add up according to the description and hence my code marks it as invalid. Somehow, this is supposed to be a valid Visa Number and CS50 is showing me a wrong result.

What am I missing here?

enter image description here

1 Answer 1

0

Your algorithm is incomplete. Each instance of 16 needs to be resolved to a single digit integer by adding its digits to become 7. CS50's instructions state this when they say to "then add those product's digits together." They mean the digits of each individual product; the actual addition of each product is done in step 2. This will make your 92 become 47. When you add this to 43, you get 90, and 90 % 10 = 0. CS50's inst

1
  • Thanks Rob! Finally I can continue :-)
    – Joesns
    Mar 29, 2021 at 21:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .