Const K = 13; Var M:array[1..K] of integer; i,A:integer; S:longint; Begin Write('Исходный массив: '); For i:= 1 to K do Begin M[i]:=random(21)-10; Write(M[i],' ') End; WriteLn; Write('A = '); ReadLn(A); S:=0; For i:= 1 to K do if M[i] > A then S:=S+M[i]; WriteLn('S = ',S) End.
K = 13;
Var
M:array[1..K] of integer;
i,A:integer;
S:longint;
Begin
Write('Исходный массив: ');
For i:= 1 to K do
Begin
M[i]:=random(21)-10;
Write(M[i],' ')
End;
WriteLn;
Write('A = ');
ReadLn(A);
S:=0;
For i:= 1 to K do
if M[i] > A then S:=S+M[i];
WriteLn('S = ',S)
End.
Пример:
Исходный массив: 9 -10 -6 6 -7 -1 -9 0 10 -8 -5 7 -7
A = 3
S = 32