I'm working on credit PSET from CS50 and I managed to do most of the code but when I reach the conditions to check if the card is Valid it gives me this error when I try to compile it. use of logical '||' with constant operand, use '|' for a Bitwise operation. This is the part that breaks in my code.
if (counter > 12 && counter < 17) // check first condition
{
if (sum % 10 == 0) // check 2nd condition
{
if (number != (4 || 34 || 37 || 51 || 52 || 53 || 54 || 55))
{
do
{
testnumber4 /= 10;
}
while (testnumber4 != (4 || 34 || 37 || 51 || 52 || 53 || 54 || 55));
if (testnumber4 == 4)
{
printf("VISA\n");
}
else if (testnumber4 == (34 || 37))
{
printf("AMEX\n");
}
else if (testnumber4 == (51 || 52 || 53 || 54 || 55))
{
printf("MASTERCARD\n");
}
else
{
printf("INVALID\n");
}
}
else
{
printf("INVALID\n");
}
}
else
{
printf("INVALID\n");
}
}
else
{
printf("INVALID\n");
}