program kombinasi_faktorial;
uses wincrt;
i,n,x:integer;
write('Masukkan bilangan x =');readln(x);
fn:=1;
fx:=1;
fn_x:=1;
for i:= 2 to n do
fn:=fn*i;
for i := 2 to x do
fx:=fx*i;
for i:= 2 to (n-x) do
fn_x:=fn_x*i;
kombinasi:=fn/(fx*fn_x);
writeln(n,' Kombinasi ',x, ' = ',Kombinasi:0:0);
uses wincrt;
var
fn,fx,fn_x,Kombinasi:real;i,n,x:integer;
begin
write('Masukkan bilangan n =');readln(n);write('Masukkan bilangan x =');readln(x);
fn:=1;
fx:=1;
fn_x:=1;
for i:= 2 to n do
fn:=fn*i;
for i := 2 to x do
fx:=fx*i;
for i:= 2 to (n-x) do
fn_x:=fn_x*i;
kombinasi:=fn/(fx*fn_x);
writeln(n,' Kombinasi ',x, ' = ',Kombinasi:0:0);
Posting Komentar