My code compiles and runs. Separating out the required numbers also works. The problem in my output seems to start at the processing of Luhn's Algorithim. The section of below code processes the required credit card numbers.
If it is greater than 10 separate the numbers, add the remainder to sum, and then add a 1.
If it is less than 10, it just increments the sum.
If is = to 10 then it increments the sum by 1.
Anyone have any thoughts? I have a printf line at the end of the block of code that prints out the d variable and they are wrong, that's how I know it starts here. I've tried using else if statements instead of all if, but I seem to get more errors so I just stuck with a series of if statements.
if (c1 > 10)
{
d1 = 1 + (c1 % 10);
sum = sum + d1;
}
if (c1 < 10)
{
sum = sum + c1;
}
if (c1 == 10)
{
sum = sum + 1;
}