Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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,0then 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 .

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

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

![]() |
![]() |
![]() |

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