I have the correct output, but Check50 says it's wrong. Anyone have idea why?
if ( checksum % 10 == 0 )
{
// AMEX 15 digits; start with 34,37
if ( (length == 15) && (nd[length]==3) && (nd[length-1]==4 || nd[length-1] ==7))
{
printf("AMEX\n");
}
// MASTERCARD 16 digits; start with 51-55
else if ( (length == 16) && (((nd[length]==5) && ( 0 < nd[length-1] || nd[length-1] < 6 )) || ((nd[length-1]==2) && ( nd[length-1]==2 ))))
{
printf("MASTERCARD\n");
}
// VISA 13 and 16 digits; start with 4
else if ( ((length == 16) || (length == 13)) && (nd[length]==4) )
{
printf("VISA\n");
}
else
{
printf("INVALID\n");
return 0;
}
}