Q

Getting a check digit program to work

I am having trouble getting a check digit program to work using a nine-digit number to generate a tenth-check digit, I tried several ways, but I keep getting the wrong results. Any suggestions?

Try arithmetic... Without knowing which check digit algorithm you are using, I would not be able to comment. I would normally look at your code and run through the working and non-working values to see what was wrong --- pretty much what you would be doing. I would also check that the results I am TOLD I should get are in fact themselves correct!

But in general, you first have to understand the algorithm. Use paper and pen to run though the steps you would take to get a right answer every time.

Then take your successful method and design the code. You may need a few tweaks, but it should work.


This was first published in September 2004

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close