Sscript program kombinasi :
program combine_raffi_111221110;
uses WinCrt;
procedure Fak(var f,res:integer);
var
i:integer;
begin
res:=1;
for i:=2 to f do res:=res*I;
end;
var
t:char;
l,x:shortint;
R,N,NR,f1,f2,f3:integer;
c:real;
begin
repeat
clrscr;
l:=47;
gotoxy (2,1);
for x:=1
to l do write (#61);
gotoxy (2,3);
for x:=1
to l do write (#61);
gotoxy (2,6);
for x:=1
to l do write (#61);
gotoxy (56,1);
for x:=1
to 21
do write (#61);
gotoxy (56,3);
for x:=1
to 21
do write (#61);
gotoxy (56,2);
write ('
STRUKTUR DATA ');
gotoxy (22,2);
write (#75#79#77#66#73#78#65#83#73);
gotoxy (2,4);
write ('Jumlah Data =
'); readln(N);
gotoxy (56,2);
write (#78#85#82#32);
gotoxy (2,5);
write ('Jumlah Kombinasi = ');
readln(R);
gotoxy (60,2);
write (#82#65#70#70#73);
NR:=N-R;
Fak(N,f1);
Fak(NR,f2);
Fak(R,f3);
c:=f1/(f2*f3);
writeln;
gotoxy (2,7);
write ('Hasil Kombinasi = ',c:0:0);
gotoxy (65,2);
write (#32#45#32#49#49#49#50#50#49#49#49#48);
gotoxy (2,8);
for x:=1
to l do write (#61);
gotoxy (57,20);
write ('Try Again? (Y/N) : '); readln (t);
until (t='n')
or (t='N');
end.
No comments:
Post a Comment