SHARE
TWEET

Latihan 10 Free Pascal Console

stevennathaniel Jan 2nd, 2014 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program Latihan10;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}{$IFDEF UseCThreads}
  7.   cthreads,
  8.   {$ENDIF}{$ENDIF}
  9.   Classes
  10.   { you can add units after this };
  11.  
  12.  
  13. var
  14.  
  15.   Fac, Num, i: Integer;
  16. begin
  17.  
  18.   write('Mohon memasukan nomer: ');
  19.  
  20.   readln(Num);
  21.  
  22.   Fac:=1;
  23.  
  24.   for i:= Num downto 1 do
  25.  
  26.   Fac:= Fac * i;
  27.  
  28.   writeln('Factorial dari ', Num, ' adalah ', Fac);
  29.  
  30.   writeln('Tekan tombol ENTER untuk menutup');
  31.  
  32.   readln;
  33.  
  34.  
  35.  
  36. end.
RAW Paste Data
Top