Pagini recente » Cod sursa (job #2901046) | Cod sursa (job #3169142) | Cod sursa (job #257381) | Cod sursa (job #860290) | Cod sursa (job #5606)
Cod sursa(job #5606)
const r:array[0..19] of byte=(0,1,5,2,8,3,9,2,8,7,7,8,4,7,3,8,4,1,5,4);
var n:string;
nr,err:byte;
t,i:integer;
begin
assign(input, 'cifra.in'); reset(input);
assign(output,'cifra.out'); rewrite(output);
readln(t);
for i:=1 to t do begin
readln(n);
delete(n,1,length(n)-2);
val(n,nr,err);
writeln((4*(nr div 4)+r[nr mod 4])mod 10);
end;
close(input); close(output);
end.