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
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:
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?