Вопрос:

The provided image contains code snippets and text related to programming tasks, specifically focusing on arrays in Pascal (or a similar language). Can you extract and present the first programming task described in the text?

Смотреть решения всех заданий с листа

Ответ:

Задание 1

Составить программу, позволяющую в одномерном массиве, состоящем из N вещественных элементов, вычислить сумму положительных элементов.

program massiv_1;
const N=10;
type mas=array [1..N] of Real;
procedure Vvodmas(var A:mas);
vari:Integer;
begin
for i:=1 to N do A[i]:=-50+Random(101)+random;
end;
procedure Vivodmas(A:mas);
vari:Integer;
begin
for i:=1 to N do Write(A[i]:8:2);
Writeln
end;
function Summa(A:mas):real;
var i: Integer; s:real;
begin
s:=0;
for i:=1 to N do if A[i]>0 then s:=s+A[i];
Summa:=s;
end;
var A: mas;
begin
Randomize; Vvodmas(A);
Writeln ('Исходныймассив:'); Vivodmas(A);
Writeln('Ответ: ', Summa(A):0:2);
Readln
end.
ГДЗ по фото 📸
Подать жалобу Правообладателю