Advertisement
trankhanh47

Giacanho

Jan 2nd, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.49 KB | None | 0 0
  1. program giacanho;
  2. uses crt;
  3. type x1=array[1..100] of integer;
  4. var A,B:x1; i,max,j,n:integer;
  5. begin
  6.    clrscr;
  7.    Write('Nhap so luong can ho: ');readln(n);
  8.    For i:=1 to n do begin
  9.      Write('Gia can ',i,' = ');readln(A[i]);    end;
  10.    B[i]:=0;
  11.    For i:=1 to n do
  12.      For j:=i to n do
  13.       If A[i]=A[j] then inc(B[i]);
  14.    Max:=B[1];
  15.    For i:=2 to n do
  16.      If B[i]>Max then Max:=B[i];
  17.    For i:=1 to n do
  18.      If Max=B[i] then
  19.       Writeln(B[i],' ',A[i]);
  20.    readln
  21.    end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement