Pagini recente » Cod sursa (job #1862821) | Cod sursa (job #1428036) | Cod sursa (job #1029429) | Cod sursa (job #2178290) | Cod sursa (job #2802)
Cod sursa(job #2802)
var i,j,r,c,x,t:longint;
f,g:text;
n:longint;
function cif(n:longint):integer;
var c:integer;
begin
c:=n mod 10;
for i:=1 to n-1 do
begin
c:=c*n;
c:=c mod 10;
end;
cif:=c;
end;
begin
assign(f,'cifra.in');reset(f);
assign(g,'cifra.out');rewrite(g);
readln(f,t);
for r:=1 to t do
begin
readln(f,n); x:=0;
for j:=1 to n do
begin
x:=x+cif(j);
x:=x mod 10;
end;
writeln(g,x);
end;
close(f);close(G);
end.