i'm new to programming so forgive me if I ask a ridiculous question. I'll be asking plenty of questions, but here is my problem with credit. I run my code, and it prompts me for a credit card number as it should, but when I input the credit card number it breaks out of the do-while loop and keeps accepting input rather than continuing with the program. Please try the code yourself to see what I mean. What did I do wrong? why is my code behaving this way. Please explain.
#include <stdio.h>
#include <cs50.h>
int main(void)
{
long long cc_number;
do
{
printf("Credit Card Number: ");
cc_number = get_long_long();
}
while (cc_number < 0);
int count = 0;
long long copy;
copy = cc_number;
while (cc_number > 0)
{
copy = copy / 10;
count++;
}
long long cc_number_copy;
cc_number_copy = cc_number;
int digits[count];
for (int i = 0; i < count; i++)
{
digits[i] = cc_number_copy % 10;
cc_number_copy = cc_number_copy / 10;
printf(" %i\n", digits[i]);
}
}