2010/11 – Fase scolastica – 20

Si consideri il seguente frammento di programma:

Var
   T: Array[0..13] of Integer;
Function f(D, k: Integer): Integer;
Var
   i, j, ris: Integer;
Begin
   i:=0;
   j:=D-1;
   ris:=0;
   While(i < j) Do
      If(T[i]+T[j] > k) Then
         Begin
            ris:=ris+1;
            j:=j-1
         End
      Else
         i:=i+1;
   f:=ris
End;

Begin
   T[0] :=-10; T[1] :=-3; T[2] :=-1; T[3] :=1;  T[4]:=2;
   T[5] :=4;   T[6] :=5;  T[7] :=7;  T[8] :=9;  T[9]:=10;
   T[10]:=20;  T[11]:=25; T[12]:=31; T[13]:=34;
   Write('num=', f(14, 25))
End.

Cosa viene visualizzato a video dall’esecuzione del programma principale?