1 câu trả lời
program xuathien;
uses crt;
var max,d,i,j,n,pt:integer;
A:array[1..100] of integer;
begin
clrscr;
write('Nhap so luong phan tu: '); readln(n);
writeln('NHAP TUNG PHAN TU CUA MANG');
for i:=1 to n do
begin
write('A[',i,']= ');
readln(A[i]);
end;
max:=1; pt:=A[1];
for i:=1 to n do
begin
d:=0;
for j:=i to n do
if A[j]=A[i] then inc(d);
if d>max then
begin
max:=d;
pt:=A[i];
end;
end;
write(pt,' co so lan xuat hien ',max,' la nhieu nhat');
readln
end.
Câu hỏi trong lớp
Xem thêm