program Project15;
{$APPTYPE CONSOLE}
uses
SysUtils;
procedure faktorial(var fak, hasil:integer);
var
a:integer;
begin
hasil:=1;
for a := 2 to fak do
hasil:=hasil*a;
end;
var
z,b,c,d,nminr:integer;
f1,f2,f3:integer;
x:real;
begin
writeln ('NIM : 114224008');
writeln ('NAMA : AZIZUN NURRACHMAN');
writeln ('================================');
writeln ('CONTOH PENULISAN RUMUS FAKTORIAL');
writeln ('================================');
writeln ('');
write('Masukkan N = '); readln(b);
write('Masukkan R = '); readln(c);
faktorial(b,f1);
nminr:=b-c;
faktorial(nminr,f2);
faktorial(c,f3);
x:=f1/f2*f3;
writeln('Hasil = ', x:3:2);
readln;
{ TODO -oUser -cConsole Main : Insert code here }
end.
{$APPTYPE CONSOLE}
uses
SysUtils;
procedure faktorial(var fak, hasil:integer);
var
a:integer;
begin
hasil:=1;
for a := 2 to fak do
hasil:=hasil*a;
end;
var
z,b,c,d,nminr:integer;
f1,f2,f3:integer;
x:real;
begin
writeln ('NIM : 114224008');
writeln ('NAMA : AZIZUN NURRACHMAN');
writeln ('================================');
writeln ('CONTOH PENULISAN RUMUS FAKTORIAL');
writeln ('================================');
writeln ('');
write('Masukkan N = '); readln(b);
write('Masukkan R = '); readln(c);
faktorial(b,f1);
nminr:=b-c;
faktorial(nminr,f2);
faktorial(c,f3);
x:=f1/f2*f3;
writeln('Hasil = ', x:3:2);
readln;
{ TODO -oUser -cConsole Main : Insert code here }
end.