Объяснение:
program ArrayX;
var
x : array [1..10] of integer;
i, qty : integer;
begin
qty:=0;
for i:= 1 to 10 do begin
x[i] := random(20)-10;
if x[i] > 2 then qty := qty+1;
writeln('x[',i,'] = ',x[i]);
end;
writeln('Qty of x>2 = ',qty);
end.
Free Pascal Compiler version 2.6.2-8 [2014/01/22] for x86_64
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling main.pas
Linking a.out
18 lines compiled, 0.2 sec
/usr/bin/ld.bfd: warning: link.res contains output sections; did you forget -T?
x[1] = 0
x[2] = 1
x[3] = 4
x[4] = 6
x[5] = 2
x[6] = 7
x[7] = 0
x[8] = 6
x[9] = -2
x[10] = 2
Qty of x>2 = 4
...Program finished with exit code 0
Press ENTER to exit console.
first_list = []
second_list = []
coincidences_list = []
first_list_len = input('Длина первого списка: ')
for i in range(1, int(first_list_len)+1):
input_text = input('{} элемент певого списка: '.format(i))
first_list.append(input_text)
second_list_len = input('\nДлина второго списка: ')
for i in range(1, int(second_list_len)+1):
input_text = input('{} элемент певого списка: '.format(i))
second_list.append(input_text)
for i in first_list:
if i in second_list and i not in coincidences_list:
coincidences_list.append(i)
print('\nПовторяющиеся значения: {}'.format(' '.join(coincidences_list)))
Файл с ответом прилагается