When I run this program my count
variable goes only up to 10
for a reason I don't understand and I want it to go up to 16
in order to check if the input from the user is a card number (16 digits).
I dont specifically want to check if it is a card number, I just want to check if it has 16 digits.
void payment() {
int payway;
int cardnum;
int count = 0;
printf("Type 1 if you want to pay with card and have a discount or 2 if you want to pay with cash:\n");
scanf("%d", &payway);
switch (payway) {
case 1:
{
do {
printf("Type your CC number:\n");
scanf("%d", &cardnum);
while (count != 0) {
cardnum = cardnum / 10;
count++;
}
} while (count != 16);
}
break;
}
}