Permutasi

Posted on 01.07.2010

0


program permutasi(input,output);
uses crt;
var
   n,r:byte;

function faktorial(c:byte):integer;
begin
   if c<=1 then
      faktorial:=1
   else
      faktorial:=c*faktorial(c-1);
end;

function permutasi(a,b:byte):real;
begin
   permutasi:=faktorial(a)/faktorial(a-b);
end;

begin
   clrscr;
   writeln('Program mencari nilai permutasi');
   write('Masukkan nilai n : '); readln(n);
   write('Masukkan nilai r : '); readln(r);
   writeln('Hasil Perhitungan : ', permutasi(n,r):0:2);
   readln;
end.

Posted in: Pascal Code