Var
n, i, r, sum, s: integer;
ms: array[1..100]of char;
begin
randomize;
n := random(3, 7);
var ar := arrrandom(n, 1, 50);
for i := 1 to n - 1 do
begin
r := random(1, 2);
if(r = 1) then ms[i] := '+'
else ms[i] := '-'
end;
s := ar[0];
write(ar[0], ' ');
for i := 1 to n - 1 do
begin
write(ms[i], ' ', ar[i], ' ');
if(ms[i] = '+') then s := s + ar[i]
else s := s - ar[i];
end;
write(' = ');
read(sum);
if(s = sum)
then
write('Правильно')
else
write('Неправильно, правильный ответ : ', s);
end.