Дан одномерный массив А из 12-ти элементов. Найти суммы отрицательных элементов и суммы положительных элементов
Var A:array [1..12] of integer;sumpol, sumotr:integer;i:integer;BeginFor i:=1 to 12 do read A[i];sumotr:=0; sumpol:=0;For i:=1 to 12 do begin if A[i]<0 then sumotr:=sumotr+A[i]else sumpol:=sumpol+A[i];Writeln(sumpol);Writeln(sumotr);End.
Оцени ответ
