Pagini recente » Cod sursa (job #2709430) | Cod sursa (job #970778) | Cod sursa (job #2857872) | Cod sursa (job #2833865) | Cod sursa (job #289503)
Cod sursa(job #289503)
program suma;
const fin = 'cifra.in';
fout = 'cifra.out';
a1:array [0..9] of byte = (0,1,5,2,8,3,9,2,8,7);
a2:array [0..9] of byte = (0,1,7,0,6,1,7,4,8,7);
var aux,t:integer;
a:string;
begin
assign(input,fin);
assign(output,fout);
reset(input);
rewrite(output);
readln(t);
while not eof() do
begin
readln(a);
if length(a)>1 then
aux:=(ord(a[length(a)-1])-48) mod 10
else
aux:=0;
t:= 7*aux mod 10;
if aux mod 2 = 0 then
inc(t,a1[(ord(a[length(a)])-48)])
else
inc(t,a2[(ord(a[length(a)])-48)]);
writeln(t mod 10);
end;
close(input);
close(output);
end.