Pagini recente » Cod sursa (job #961168) | Cod sursa (job #69829) | Cod sursa (job #2011971) | Cod sursa (job #2785233) | Cod sursa (job #2209)
Cod sursa(job #2209)
var a:array[1..30000]of integer;
n,i,l,j,c,x,y,t:integer;
f,g:text;
begin
assign(f,'cifra.in');reset(f);
assign(g,'cifra.out');rewrite(g);
readln(f,T);
for l:=1 to T do
begin
readln(f,n);
x:=0;
for i:=1 to n do
begin y:=i;c:=1;
for j:=1 to y do
begin
c:=y*c;
c:=c mod 10;
end;
x:=x+c;
x:=x mod 10;
end;
writeln(g,x);
end;
close(f);close(g);
end.