DIM m AS INTEGER CLS INPUT "m=", m DIM a(1 TO m, 1 TO m) AS INTEGER RANDOMIZE TIMER FOR i = 1 TO m FOR j = 1 TO m a(i, j) = 50 * RND - 25 PRINT USING ""; a(i, j); NEXT j PRINT NEXT i DIM P AS DOUBLE, S AS INTEGER DIM B(1 TO m) AS DOUBLE P = 1 FOR i = 1 TO m S = 0 FOR j = 1 TO m IF a(i, j) > 0 THEN P = P * a(i, j) S = S + a(i, j) NEXT j B(i) = S / m NEXT i PRINT "P="; P PRINT "Vector" FOR i = 1 TO m PRINT USING "###."; B(i) NEXT i
begin writeln('Введите строку: '); readln(s); if pos('а', s) <> 0 then writeln('В строке есть буква "а"') else writeln('В строке нет буквы "а"'); end.
2) var s: string; i, a: byte;
begin a := 0; writeln('Введите строку: '); readln(s); for i := 1 to length(s) do if s[i] = 'м' then a := a + 1; writeln('В строке буква "м" встречается ', a, ' раз(а)'); end.
3) var s: string;
begin writeln('Введите строку: '); readln(s); while pos('и', s) <> 0 do delete(s, pos('и', s), 1); writeln('Строка после удаления букв(ы) "и": ', s); end.
CLS
INPUT "m=", m
DIM a(1 TO m, 1 TO m) AS INTEGER
RANDOMIZE TIMER
FOR i = 1 TO m
FOR j = 1 TO m
a(i, j) = 50 * RND - 25
PRINT USING ""; a(i, j);
NEXT j
PRINT
NEXT i
DIM P AS DOUBLE, S AS INTEGER
DIM B(1 TO m) AS DOUBLE
P = 1
FOR i = 1 TO m
S = 0
FOR j = 1 TO m
IF a(i, j) > 0 THEN P = P * a(i, j)
S = S + a(i, j)
NEXT j
B(i) = S / m
NEXT i
PRINT "P="; P
PRINT "Vector"
FOR i = 1 TO m
PRINT USING "###."; B(i)
NEXT i
Пример
m=5
3 -12 -2 -3 -4
11 -13 21 20 14
21 5 18 -20 -1
-3 24 -24 -19 8
-14 -24 -7 -2 -3
P= 70413235200
Vector
-3.60000
10.60000
4.60000
-2.80000
-10.00000
var
s: string;
begin
writeln('Введите строку: ');
readln(s);
if pos('а', s) <> 0 then writeln('В строке есть буква "а"')
else writeln('В строке нет буквы "а"');
end.
2)
var
s: string;
i, a: byte;
begin
a := 0;
writeln('Введите строку: ');
readln(s);
for i := 1 to length(s) do if s[i] = 'м' then a := a + 1;
writeln('В строке буква "м" встречается ', a, ' раз(а)');
end.
3)
var
s: string;
begin
writeln('Введите строку: ');
readln(s);
while pos('и', s) <> 0 do delete(s, pos('и', s), 1);
writeln('Строка после удаления букв(ы) "и": ', s);
end.