Решите одно из предложенных, умоляю дан массив а5 найти сумму и количество положительных элементов дан массив а5 определить количество отрицательных элементов дан массив а6 определить количество положительных элементов
1) const n=5; var a:array[1..n]of integer; i,k,s:integer; begin for i:=1 to n do begin readln(a[i]); if a[i]>0 then begin s:=s+a[i]; k:=k+1ж end; writeln('ARRAY:'); for i:=1 to n do write(a[i]:4); writeln; writeln('S: ',S,' k: 'k); end.
Program esep; var i,j,k,n,sum:integer; input,output:text; a:array[1..100] of integer; flag:boolean; begin flag:=false; Assign(Input,'d.in'); reset(input); readln(input,n); assign(output, 'd.out'); rewrite(output); writeln('Input elements'); readln (n); for i:=1 to n do read(a[i]); for i:=1 to n do for j:=1 to n do for k:=1 to n do if (i<>j) and (j<>k) and (i<>k) then if a[i]+a[j]+a[k]=0 then begin writeln (output,'Yes'); flag:=true; halt; end; if flag=false then writeln(output,'No'); close(input); close(output); end.
Var i,j,k,n,sum:integer; input,output:text; a:array[1..100] of integer; flag:boolean; begin flag:=false; Assign(Input,'d.in'); reset(input); readln(input,n); assign(output, 'd.out'); rewrite(output); writeln('Input elements'); readln (n); for i:=1 to n do read(a[i]); for i:=1 to n do for j:=1 to n do for k:=1 to n do if (i<>j) and (j<>k) and (i<>k) then if a[i]+a[j]+a[k]=0 then begin writeln (output,'Yes'); flag:=true; halt; end; if flag=false then writeln(output,'No'); close(input); close(output); end.
const
n=5;
var
a:array[1..n]of integer;
i,k,s:integer;
begin
for i:=1 to n do
begin
readln(a[i]);
if a[i]>0 then
begin
s:=s+a[i];
k:=k+1ж
end;
writeln('ARRAY:');
for i:=1 to n do
write(a[i]:4);
writeln;
writeln('S: ',S,' k: 'k);
end.