Pagini recente » Cod sursa (job #135988) | Cod sursa (job #2579466) | Cod sursa (job #1118351) | Rating Cezar V. Alexandru (Lovemaker) | Cod sursa (job #277314)
Cod sursa(job #277314)
Program dudy;
var t,j,p,i,s,x,z,q:integer;
g,f:text;
begin
assign (g,'cifre.in');
assign (f,'cifre.out');
reset (g);
rewrite (f);
read (g,t);
for i:=1 to t do
begin
read (g,q);
s:=0;
for j:=1 to q do
begin
x:=1;
For p:=1 to j do
begin
x:=x*j;
end;
s:=s+x;
end;
z:=s mod 10;
writeln(f,z);
end;
close(f);
close(g);
end.