program banyak;
uses wincrt;
var i,n,j,modus:integer;
A,frek:array[1..100] of integer;
begin
write('masukkan banyak bilangan');
readln(n);
writeln('masukan data');
for i:=1 to n do
readln(A[i]);
writeln;
for i:=1 to n-1 do
begin
for j:=i+1 to n do
if A[i]=A[j] then
frek[i]:=frek[i]+1;
end;
modus:=1;
for i:=1 to n do
begin
if frek[modus]<frek[i] then
modus:=i;
end;
write('Modus: ',A[modus],' sejumlah ',frek[modus]+1);
end.
Tidak ada komentar:
Posting Komentar