Program n1; Uses Crt; Var c: array[1..1000] of integer; n, i, null, otric, polozhit :integer; Begin writeln('Razmer massiva = '); Readln(n);
for i:=1 to n do begin c[i]:=random(40) - 20; write(c[i]:4); end;
writeln();
otric:=0; polozhit:=0; null:=0; for i:=1 to n do begin if (c[i]<0) then otric:=otric+1; if (c[i]>0) then polozhit:=polozhit+1; if (c[i]=0) then null:=null+1; end; writeln('Kol-vo chisel < 0: ', otric); writeln('Kol-vo chisel > 0: ', polozhit); writeln('Kol-vo chisel = 0: ', null); End.
Держи 1 и 3 ;) :
1)
Program solution;
Uses Crt;
Var i, poloz, otrits, zero : Byte;
n : integer;
Begin
ClrScr;
poloz := 0;
otrits := 0;
zero := 0;
for i := 1 to 10 do
begin
readln(n);
if n > 0 then poloz := poloz + 1;
if n < 0 then otrits := otrits + 1;
if n = 0 then zero := zero + 1;
end;
write('+: ', poloz, ', -: ', otrits, ', 0: ', zero);
ReadKey;
End.
3:
Program solution;
Uses Crt;
Var sum, num, count : Word;
Begin
ClrScr;
sum := 0;
count := 0;
while sum <= 100 do
begin
write(': ');
readln(num);
sum := sum + num;
count := count + 1;
end;
writeln('Было введено чисел: ', count);
ReadKey;
End.
Uses Crt;
Var
c: array[1..1000] of integer;
n, i, null, otric, polozhit :integer;
Begin
writeln('Razmer massiva = '); Readln(n);
for i:=1 to n do begin
c[i]:=random(40) - 20;
write(c[i]:4);
end;
writeln();
otric:=0; polozhit:=0; null:=0;
for i:=1 to n do begin
if (c[i]<0) then otric:=otric+1;
if (c[i]>0) then polozhit:=polozhit+1;
if (c[i]=0) then null:=null+1;
end;
writeln('Kol-vo chisel < 0: ', otric);
writeln('Kol-vo chisel > 0: ', polozhit);
writeln('Kol-vo chisel = 0: ', null);
End.