Computing.Net > Forums > Programming > Check digit modulas number

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Check digit modulas number

Reply to Message Icon

Name: Galvins2d
Date: March 15, 2003 at 19:19:40 Pacific
OS: WIN 2000 PRO
CPU/Ram: P3
Comment:

for any one who knows what a check digit modulas number is could they please give me some psudo code on how to create a validation procedure for a check digit 10 number
to refresh those memorys it is the one where you add a check digit at the end of an account number for example 12345x then you give the check digit the value of one then 5 gets the value of 2 4 gets 3 and so on you then multiply them together like this
1 2 3 4 5 x
x x x x x x
6 5 4 3 2 1
-------
6,10,12,10,0

then add your total and / 10 ( or any number you want)

please i dont meen to sound ungrateful but i need this answer A.S.A.P .




Sponsored Link
Ads by Google

Response Number 1
Name: SN
Date: March 15, 2003 at 19:52:36 Pacific
Reply:

I had no idea what a check digit modulus number was before I read your post, but it bears some resemblance to a checksum, so I assume that it has something to do with making sure that the account number (in the above example) is not accidentally messed up. I think you missed an extra 12 in there. If I were to do this and were given the original account number as an Integer, and the check digit another integer, I might try the following:

int result=0;
accountNum=accountNum*10;
for (int i=0; iresult=10;
accountNum=1234;
result=10+(4)*(2+1) =>result=22;
accountNum=123;
result=22+(3)*(3+1) =>result=34;
accountNum=12;
result=34+(2)*(4+1) =>result=44;
accountNum=1;
result=44+(1)*(5+1) =>result=60;

And now result is the number you would divide by 10 and get 6. I may be way off on what I guessed this check digit to be, sorry if I am. Also note that I totally destroyed all your input data, and assumed accountNum.length was the number of digits in the account number (including check digit) and this won't work exactly, but it will be a good starting place. Best of luck,
-SN


0

Response Number 2
Name: SN
Date: March 15, 2003 at 19:58:26 Pacific
Reply:

BLAST this stupid system!!! If it weren't for that hot blonde that appears on the right side every now and then (you know the one I mean, with the white tank top) I wouldn't even come to this forum anymore. Here it is without the html mess up:

I had no idea what a check digit modulus number was before I read your post, but it bears some resemblance to a checksum, so I assume that it has something to do with making sure that the account number (in the above example) is not accidentally messed up. I think you missed an extra 12 in there. If I were to do this and were given the original account number as an Integer, and the check digit another integer, I might try the following:

int result=0;
accountNum=accountNum*10;
for (int i=0; i < accountNumlength; i++) {
   result=result+(accountNum%10)*(i+checkDigit);
}
For the above example, this does the following steps:
accountNum=123450 (to ensure that the first iteration doesn't add to result)
result=0+0*(1+0); =>result=0;
accountNum=12345;
result=0+(5)*(1+1) =>result=10;
accountNum=1234;
result=10+(4)*(2+1) =>result=22;
accountNum=123;
result=22+(3)*(3+1) =>result=34;
accountNum=12;
result=34+(2)*(4+1) =>result=44;
accountNum=1;
result=44+(1)*(5+1) =>result=60;

And now result is the number you would divide by 10 and get 6. I may be way off on what I guessed this check digit to be, sorry if I am. Also note that I totally destroyed all your input data, and assumed accountNum.length was the number of digits in the account number (including check digit) and this won't work exactly, but it will be a good starting place. Best of luck,
-SN


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Check digit modulas number

Javascript check digit generator www.computing.net/answers/programming/javascript-check-digit-generator/14761.html

Mod11 check digit www.computing.net/answers/programming/mod11-check-digit/9759.html

Help with C++ and Mod 11 program www.computing.net/answers/programming/help-with-c-and-mod-11-program/5553.html