Pagini recente » Cod sursa (job #2037555) | Cod sursa (job #232689) | Cod sursa (job #2021577) | Cod sursa (job #1981333) | Cod sursa (job #561471)
Cod sursa(job #561471)
var i,s,j,t,n,u,p:longint;
function pt(x:integer):integer;
begin
p:=1;
for j:=1 to n do
begin
p:=p*i;
end;
pt:=p
end;
begin
assign(input,'cifra.in');reset(input);
assign(output,'cifra.out');rewrite(output);
readln(t);
while not eof(input) do
begin
readln(n);
for i:=1 to n do
begin
s:=s+pt(i) mod 10;
end;
writeln(s mod 10);
s:=0;
end;
close(input);
close(output);
end.