Найти сумму элементов массива А(10), значения которых лежат в интервале от 15 до 75.
Prorgam z;
Var a:array [1..100] of integer;
i,s:integer;
Begin
Randomize;
s:=0;
For i:=1 to 10 do begin
a[i]:=random(100)+1;
If (a[i]>=15) then begin
If a[i]<=75 then begin
s:=s+a[i];
End;
Writeln(s);
End.
var a:array[1..10]of integer;
i,sum:integer;
begin
randomize;
for i:=1 to 10 do begin
a[i]:=random(51)+15;
sum:=sum+a[i];
end;
writeln(sum);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Prorgam z;
Var a:array [1..100] of integer;
i,s:integer;
Begin
Randomize;
s:=0;
For i:=1 to 10 do begin
a[i]:=random(100)+1;
If (a[i]>=15) then begin
If a[i]<=75 then begin
s:=s+a[i];
End;
Writeln(s);
End.
var a:array[1..10]of integer;
i,sum:integer;
begin
randomize;
for i:=1 to 10 do begin
a[i]:=random(51)+15;
sum:=sum+a[i];
end;
writeln(sum);
end.