ISBN2 by D

procedure Gnat.Spitbol.Patterns.R is
A:String:=Get_Line;C:String:="0123456789X";I,Q,T,X,Y:Integer:=1;Begin
Q:=Index(V(A),"?");X:=A'Last;Y:=X/15;<<l>>T:=0;A(Q):=C(I);For J In 5..X-1 Loop
T:=T+((15-j)*(1-Y)+(3-J Mod 2*2)*Y)*Integer'Value(A(j..J));end loop;exit
when(11-Y-T)Mod(11-Y)=Index(V(C),A(X..X))-1;I:=I+1;Goto L;Put_Line(a);R;end;

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page