I am still really new to C and programming in general(just started a week ago) and I'm having difficulty with the do while loop. My code doesn't run beyond while (ccNUM < 0);
.
I tried running debug50 and even though while (ccNUM < 0);
is false it doesn't move on to the next link of code.
Any help will be greatly appreciated!
The code I used:
#include <cs50.h>
#include <stdio.h>
#include <math.h>
int main(void) {
// Get Credit Card Number from User
long ccNUM;
do {
ccNUM = get_long("Insert Credit Card Number: \n");
}
while (ccNUM < 0);
// Find number of digits in Credit Card Number
int digits;
for (digits=0; 0 != ccNUM; digits++) {
ccNUM /= 10;
}
if (digits == 13 || digits == 15 || digits == 16) {
return digits;
}
else {
printf("INVALID\n");
}
printf("%i", digits);
}