Cod sursa(job #1581255)
Utilizator | Data | 26 ianuarie 2016 18:02:26 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
Program infoarenafact;
var p,n:longint;
fin,fou:text;
begin
assign(fin,'fact.in');
reset(fin);
readln(fin,p);
close(fin);
if p=0 then n:=1
else
if p<=4 then
begin
n:=p*5;
end
else if p=5 then n:=-1
else if p>5 then n:=(p*5)-5;
assign(fou,'fact.out');
rewrite(fou);
write(fou,n);
close(fou);
readln;
end.