The Gateway to Computer Science Excellence

+1 vote

Function what(x, n:integer): integer:

Var

value : integer

begin

value := 1

if n > 0 then

begin

if n mod 2 =1 then

value := value * x;

value := value * what(x*x, n div 2);

end;

what := value;

end;

convert the code in c

Var

value : integer

begin

value := 1

if n > 0 then

begin

if n mod 2 =1 then

value := value * x;

value := value * what(x*x, n div 2);

end;

what := value;

end;

convert the code in c

52,315 questions

60,426 answers

201,749 comments

95,226 users