uses crt;
var fak,m,n,t : real;
i,nn,mm,tt : integer;
begin
clrscr;
writeln('.:: menghitung faktorial ::. ');
writeln(' n! ');
writeln(' = ----------');
writeln(' m!(n!-m!) ');
writeln;
write('masukkan nilai n : '); readln(nn);
write('masukkan nilai m : '); readln(mm);
n := nn;
m := mm;
t := nn-mm;
for i := nn-1 downto 1 do
begin
n := n*i;
end;
for i := mm-1 downto 1 do
begin
m := m*i;
end;
for i := (nn-mm) - 1 downto 1 do
begin
t := t*i;
end;
fak := n / ( m * t );
writeln;
writeln('faktorial n! : ',n:5:0);
writeln('faktorial m! : ',m:5:0);
writeln('faktorial ( n! - m! ) : ',t:5:0);
writeln;
writeln('nilai faktorial : ',fak:5:0);
writeln(' create by : charles demon');
readln;
end.
Tidak ada komentar:
Posting Komentar