What function of x, n is computed by this program? Function what (x,…

PYQ GATE 1994

What function of x, n is computed by this program?

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;

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…