Pagini recente » Cod sursa (job #3282107) | Cod sursa (job #2621585) | Cod sursa (job #1797022) | Cod sursa (job #3175216) | Cod sursa (job #191450)
Cod sursa(job #191450)
var n,a,b,aux:longint;
procedure citire;
begin
assign(input,'nunta.in');
reset(input);
read(input,n);
close(input)
end;
procedure gasire;
var i:longint;
begin if n=1 then b:=1
else if n=2 then b:=2
else if n=3 then b:=3
else if n mod 2=0 then begin
a:=2;
b:=3;
for i:=3 to n do begin
aux:=a+b;
a:=b;
b:=aux
end
end
else if n mod 2=1 then b:=n-1;
end;
procedure afisare;
begin
assign(output,'nunta.out');
rewrite(output);
write(output,b);
close(output)
end;
begin
citire;
gasire;
afisare
end.