program kombinasi;
uses wincrt;
var n,r,nr,c,h1,h2,h3 :real;
i,j,k :integer;
procedure f1(var p,h1:real);
begin
h1:=1;
i :=1;
while i<=p do
begin
h1:=h1*i;
i :=i+1;
end;
end;
procedure f2(var q,h2:real);
begin
h2:=1;
j :=1;
while j<=q do
begin
h2:=h2*j;
j :=j+1;
end;
end;
procedure f3(var r,h3:real);
begin
h3:=1;
k :=1;
while k<=r do
begin
h3:=h3*k;
k :=k+1;
end;
end;
begin
writeln('-----------------------');
writeln('Nama : Krisdian Eko Robbyanto');
writeln('NIM : 111221054');
writeln('-----------------------');
write ('Banyak Data yang dikombinasi = ');readln(n);
write ('Banyak Kombinasi = ');readln(r);
nr:=n-r;
f1(n,h1);
f3(r,h3);
f2(nr,h2);
c:=h1/(h2*h3);
writeln('Hasil Kombinasi = ',c:1:0);
writeln;
end.
Tidak ada komentar:
Posting Komentar