program tugas4_okky_111221111;
uses WinCrt;
Procedure Fak(Var F,Hasil:integer);
Var
i:integer;
begin
Hasil:=1;
For i:=2 to F do Hasil:=Hasil*i;
end;
Var
R,N,NR,F1,F2,F3:integer;
C:real;
Begin
clrscr;
writeln('=====Selamat Datang di Program Faktorial=====');
writeln(' OKKY SORAYA-111221111-SEMESTER 2D');
writeln;
Write(' N = ');Readln(N);
Write(' R = ');Readln(R);
NR:=N-R;
Fak(N,F1);
Fak(NR,F2);
Fak(R,F3);
C:=F1/(F2*F3);
Writeln;
Writeln('Kombinasi yang terjadi : ',c:9:0);
end.
uses WinCrt;
Procedure Fak(Var F,Hasil:integer);
Var
i:integer;
begin
Hasil:=1;
For i:=2 to F do Hasil:=Hasil*i;
end;
Var
R,N,NR,F1,F2,F3:integer;
C:real;
Begin
clrscr;
writeln('=====Selamat Datang di Program Faktorial=====');
writeln(' OKKY SORAYA-111221111-SEMESTER 2D');
writeln;
Write(' N = ');Readln(N);
Write(' R = ');Readln(R);
NR:=N-R;
Fak(N,F1);
Fak(NR,F2);
Fak(R,F3);
C:=F1/(F2*F3);
Writeln;
Writeln('Kombinasi yang terjadi : ',c:9:0);
end.
Tidak ada komentar:
Posting Komentar