Modulus+10+Check

Mod 10 check digit as defined as Luhn algorithm

Some bar codes have a check digit. This is the standard check digit routine they use.

code format="lb" ' ' modulus 10 check digit ' function ck(x$) ln	= len(x$) for i = ln to 1 step -1 d	= val(mid$(x$,i,1)) if not(ln - i and 1) then d = int(d * 2.2) mod 10 ck	= ck + d next i ck 	= ck mod 10 ck 	= min(ck,10 - ck) end function code