program modus
TRANSCRIPT
Program Modusprogram nilaimodus;
uses wincrt;
var n,i,j: integer; ftinggi: real; fx: array[1..100]of integer; modus,x: array[1..100]of real;
begin
write ('Masukan banyak data: '); readln (n); for i:=1 to n do begin write ('Data ke-',i,' : '); readln(x[i]); fx[i]:=1; end; for i:=1 to n-1 do for j:=i+1 to n do if x[i]=x[j] then fx[i]:=fx[i]+1; ftinggi:=1; for i:=1 to n do if fx[i]>ftinggi then ftinggi:=fx[i]; writeln; writeln ('Frekuensi tertinggi adalah: ',ftinggi:0:0); writeln;
j:=0; for i:=1 to n do if fx[i]=ftinggi then begin j:= j+1; modus[j]:=x[i]; end; writeln; if j=n then writeln('Tidak ada Modus') else if ftinggi=n div j then writeln('Tidak ada Modus') else begin write ('Banyak modusnya ',j,' buah, yaitu : ' ); for i:=1 to j do
writeln (modus[i]:0:0); end; end.