Factorial

=__**Cálculo del Factorial**__=

**Utilizando FOR TO DO** code format="pascal" PROGRAM Factorial ; VAR iNum, i   : Integer ; rFactorial : Real ; BEGIN Write ('Número del que calcular el factorial: ') ; ReadLn (iNum) ;

{ cálculo del factorial } rFactorial := 1 ; FOR i := 1 TO iNum DO      rFactorial := rFactorial * i ;

WriteLn ('El factorial de ', iNum, ' vale: ', rFactorial:0:0) ; ReadLn ; END. code **Utilizando FOR DOWNTO DO** code format="pascal" PROGRAM Factorial ; VAR iNum, i   : Integer ; rFactorial : Real ; BEGIN Write ('Número del que calcular el factorial: ') ; ReadLn (iNum) ;

{ cálculo del factorial } rFactorial := 1 ; FOR i := iNum DOWNTO 1 DO      rFactorial := rFactorial * i ;

WriteLn ('El factorial de ', iNum, ' vale: ', rFactorial:0:0) ; ReadLn ; END. code