Ask the Expert

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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: