Найти сумму 10 элементов массива (на языке Паскаль)
Answers & Comments
ElternaL1ty
Var i,sum:integer; a:array[1..10] of integer; begin sum:=0; for i:=1 to 10 do begin a[i]:=1+random(99); write(a[i],' '); sum:=sum+a[i]; end; writeln; write('Сумма: ', sum); end.
Answers & Comments
i,sum:integer;
a:array[1..10] of integer;
begin
sum:=0;
for i:=1 to 10 do
begin
a[i]:=1+random(99);
write(a[i],' ');
sum:=sum+a[i];
end;
writeln;
write('Сумма: ', sum);
end.
Uses crt;
var a: array[1..10] of integer;
s,i: integer;
begin
clrscr;
for i:=1 to 10 do
begin
write('a[',i,'] = ');
readln(a[i]);
s:=s+a[i];
end;
writeln;
writeln('Sum = ', s);
end.