Pagini recente » Cod sursa (job #1076327) | Cod sursa (job #1911121) | Cod sursa (job #1162598) | Cod sursa (job #673189) | Cod sursa (job #561466)
Cod sursa(job #561466)
uses math;
var i,s,t,er,n,u:longint;
x:string;
c:extended;
procedure putere;
begin
for i:=1 to n do
begin
c:=power(i,i);
str(c:4:0,x);
delete(x,length(x)-1,1);
val(x,u,er);
if (u>1)and(u<9) then
s:=s+u
else
s:=s+u mod 10;
end;
if (s>0)and(s<9) then
writeln(s)
else
writeln(s mod 10);
s:=0;
end;
begin
assign(input,'cifra.in');reset(input);
assign(output,'cifra.out');rewrite(output);
readln(t);
while not eof(input) do
begin
readln(n);
putere;
end;
close(input);
close(output);
end.