2007/08 – Fase scolastica – 09

Si considerino le funzioni mutuamente ricorsive

Function foo(n: Integer): Integer; Forward;
Function ES9(n: Integer): Integer;
 begin
    If(n mod 2 = 1) Then
       ES9:=foo(n-3)
    Else
       ES9:=n;
End;
Function foo(n: Integer): Integer;
Begin
   If(n Mod 2 = 0) Then
      foo:=ES9(2*n)
   Else
      foo:=n;
End;

Dire cosa restituisce la chiamata ES9(51).

Risposte:

  1. 48
  2. 96
  3. 102
  4. nessuna delle precedenti