Cod sursa(job #368805)
Utilizator | Data | 25 noiembrie 2009 22:34:17 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.58 kb |
program adunare;
uses crt;
var k,i,j,n,t:word;
f,g:text;
s,m:longint;
begin
assign(f,'cifra.in');
reset(f);
assign(g,'cifra.out');
rewrite(g);
readln(f,t);
for i:=1 to t do
begin
readln(f,n);
s:=0;
for j:=1 to n do
begin
m:=1;
for k:=1 to j do
m:=m*j;
s:=s+m;
end;
writeln(g,s mod 10);
end;
close(f);
close(g);
end.