Then starting from the 2nd rightmost digit, the digit is multiplied by 2 then added to tsum, with every other digit doing the same. I would also like to add, in my mind what this code should do is: using the checks for even and odd it will start from the rightmost digit and add it to tsum, every other digit will do the same. And I am expecitng a value of 0 for tsum when inputting any card number from Paypal's Standard Test Cards. I would appreciate somebody to tell me what I'm doing wrong, thank you.ĮDIT: Apologies, cardNum is a long long. I have spent hours trying to troubleshoot and find the issue, count represents the number of digits in the card number, the rest define themselves. Luhn's Algorithmįor (int tempcount = count tempcount > 0 tempcount-) ![]() ![]() ![]() So, I'm trying to make Luhn's algorithm in C, but it doesn't return the correct values when running it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |