Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Can you edit the question and describe exactly what kind of problems you are having? We need more detailed information, along with some description of what you've done to try and resolve the problem. As this question stands, it is too vague. Commented Jul 6, 2018 at 11:25
  • Thank you for the reply. I have edited my question. Sorry for being unclear with my question. Hope it is clearer now Commented Jul 7, 2018 at 12:24
  • I don't quite understand your code but maybe try a different approach.. Possibly performing luhn's algorithm first and then validating card length at the end. Not all card lengths are 16 digits Commented Jul 9, 2018 at 8:46
  • Also you shouldn't need to have a variable after the '%' symbol. i = CC % 10 would give you the last digit, which you can then subtract from CC and divide CC by 10 for next digit - sorry if this is a bit vague Commented Jul 9, 2018 at 8:50