Вводится число N, а затем - N чисел. Определить, сколько среди них пар одинаковых чисел. 2<=N<=100. На паскале
Answers & Comments
A1darvar i, j, n, s: integer; a: array[1..100] of integer; begin read(n); for i := 1 to n do read(a[i]); for i := 1 to n - 1 do for j := i + 1 to n do if a[i] = a[j] then inc(s); write(s); end.
Answers & Comments
i, j, n, s: integer;
a: array[1..100] of integer;
begin
read(n);
for i := 1 to n do read(a[i]);
for i := 1 to n - 1 do
for j := i + 1 to n do
if a[i] = a[j] then inc(s);
write(s);
end.