1

I have compiled my version of credit, anyway check50 throws 2 fails during its check. Lines with numbers where it fails are:

:( identifies 369421438430814 as INVALID expected "INVALID\n", not "AMEX\n"

and

:( identifies 5673598276138003 as INVALID expected "INVALID\n", not "MASTERCARD\n"

From my calculation both are valid: Correct me if I am wrong, but
3 69 42 14 38 43 08 14 (to easy recognise digits) goes as follows - to begin second from last:
1*2 + 0*2 + 4*2 + 3*2 + 1*2 + 4*2 + 6*2 = 2 + 0 + 8 + 6 + 2 + 8 + (1 + 2) = 29

Second part: 4 + 8 + 3 + 8 + 4 + 2 + 9 + 3 = 41

Final: 29 + 41 = 70 ---> 70 % 10 = 0
VALID

Anyway, cs50check shows:
Amex fail

Same story is for MasterCard below. I am not doing the math here again, but you can do it for yourself. For short it comes as 28 + 32 = 60. Picture below:
enter image description here

Also, length of the numbers is right: AmEx is 15-digits and MasterCard is 16.

Are there any other requirements for validity of the credit cards, not mentioned in cs50/2020?

4

Found it:
American Express starts with 34 or 37,
Master Card starts with 51, 52, 53, 54 or 55.

This makes those two numbers INVALID despite good checksum :)

2
  • This happened me too! I was so confused lol thanks Dec 3 '20 at 8:05
  • 1
    man, thank you and thank you again, 2 hours trying to find what's wrong and this result I was going to cs50 help and ask them to fix their bot 😂. Jul 15 at 15:59

You must log in to answer this question.

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