1. program ex1;
uses crt;
var i, count : integer;
begin
count:=0;
for i:=1 to 9999 do
if (i mod 5 = 0) and (i mod 7 = 0) then
writeln(i);
count:=count+1;
if count=10 then
break;
end;
end.
2. program ex2;
var sum, count, n : integer;
n:=9999;
sum:=0;
while not (n = 0) do
readln(n);
if (not n mod 2 = 0) and (n>0) then
sum:=sum+n;
writeln('Ср. арифм. = ', sum/count);
3. program ex1;
var price, i: integer;
write('Введите цену товара за 1 кг. :');
readln(price);
for i:=1 to 15 do
write(i:6, '|');
writeln();
write('');
write((price/10*i):6,'|');
begin
var a:=ArrRandom(100,-10,10);
a.Println;
Writeln(a.Where(x->x>0).Count,' положительных, ',
a.Where(x->x<0).Count,' отрицательных')
end.
Тестовое решение:
4 -6 0 8 2 -2 -1 -8 -6 8 -3 7 4 -7 -5 9 0 -3 -7 1 0 -4 6 3 8 -10 4 9 3 5 8 5 5 8 10 4 -8 3 8 8 -9 2 7 -8 -7 -5 2 -9 0 9 -7 7 -2 -6 7 -2 -1 7 -10 2 4 1 -1 0 10 3 -8 6 -6 2 6 7 -1 -4 -1 8 0 3 0 2 -2 2 -1 5 1 -9 -4 1 -9 1 -6 -5 3 -4 -7 1 -7 -3 -7 1
51 положительных, 42 отрицательных
1. program ex1;
uses crt;
var i, count : integer;
begin
count:=0;
for i:=1 to 9999 do
begin
if (i mod 5 = 0) and (i mod 7 = 0) then
begin
writeln(i);
count:=count+1;
if count=10 then
break;
end;
end;
end.
2. program ex2;
var sum, count, n : integer;
begin
count:=0;
n:=9999;
sum:=0;
while not (n = 0) do
begin
readln(n);
if (not n mod 2 = 0) and (n>0) then
begin
sum:=sum+n;
count:=count+1;
end;
end;
writeln('Ср. арифм. = ', sum/count);
end.
3. program ex1;
var price, i: integer;
begin
write('Введите цену товара за 1 кг. :');
readln(price);
for i:=1 to 15 do
write(i:6, '|');
writeln();
for i:=1 to 15 do
write('');
writeln();
for i:=1 to 15 do
write((price/10*i):6,'|');
end.