| 
 | 
| Soluzione iterativaMN = Pot(M, N) = M*M*...*M (N fattori) Codifica function PotIter(M, N: Integer): LongInt;
Var
   I, Risp: LongInt;
begin
   Risp:=1;
   for I:=1 to N do
      Risp:=Risp*M;
   PotIter:=Risp;
end;
 Soluzione ricorsivaM0 = 1 N = 0 MN = M*MN-1 altrimenti oppure Pot(M, N) = 1 N = 0 Pot(M, N) = Pot(M, N-1)*M altrimenti Codifica function PotRic(M, N: Integer): LongInt;
begin
   if(N = 0) then
      PotRic:=1
   else
      PotRic:=M*PotRic(M, N-1);
end; | 
| 
 
 |