Программа:
Pascal:
№2)
var
m: array[1..10] of integer;
begin
m[1]:=4; m[2]:=8; m[3]:=7; m[4]:=2; m[5]:=1; m[6]:=8; m[7]:=1; m[8]:=5; m[9]:=6; m[10]:=8;
for var i := 1 to 10 do
if m[i] = m.max then m[i]:= 0;
writeln(m);
end.
№3)
const n = 10;
a: array[1..n] of integer;
i, k, tmp: integer;
for i := 1 to n do a[i] := random(0, 1);
writeln('Массив: ', a);
for i := 1 to n - 1 do
for k := 1 to n - i do
if a[k] > a[k + 1] then begin
tmp := a[k];
a[k] := a[k + 1];
a[k + 1] := tmp;
end;
writeln(a);
№5)
a1, a2: array[1..n div 2] of integer;
for i := 1 to n do a[i] := random(-10, 10);
writeln('Исходный массив: ',a);
for i := 1 to n div 2 do a1[i] := a[i];
for i := (n div 2 + 1) to n do a2[i - n div 2] := a[i];
for i := 1 to n div 2 - 1 do
for k := 1 to n div 2 - i do
if a1[k] > a1[k + 1] then begin
tmp := a1[k];
a1[k] := a1[k + 1];
a1[k + 1] := tmp;
if a2[k] < a2[k + 1] then begin
tmp := a2[k];
a2[k] := a2[k + 1];
a2[k + 1] := tmp;
for i := 1 to n do
if i <= 5 then a[i] := a1[i]
else a[i] := a2[i - n div 2];
writeln('Выходной массив: ', a);
1)
a = int(input())
b = int(input())
for i in range(a, b+1):
if i % ... == 0 and i % ... != 0:
...
print(...)
2)
x = a*2
n = 0
while a < x:
a = a + (a * 0.1)
n += 1
print(n/4)
3)
sum = 0
for i in range(100):
if a < 0 and a % 2 != 0:
sum += a
print(a)
4)
a = input()
if a.count('0') != 0:
print('est`')
else:
print('net')
5)
p = int(input())
n = int(input())
c = 0
for i in range(n):
if a > p:
c += 1
print(c)
6)
if a % 10 == 5:
7)
x = int(input())
if a <= x <= b:
8)
x = float(input())
if x > 10:
sum += x
print(x / c)
9)
while True:
if a == 0:
break
if a % 2 == 0:
10)
if x < 10:
11)
if x % 10 == 3:
12)
x = input()
if x.count('4') != 0:
print('yes')
print('no')
Программа:
Pascal:
№2)
var
m: array[1..10] of integer;
begin
m[1]:=4; m[2]:=8; m[3]:=7; m[4]:=2; m[5]:=1; m[6]:=8; m[7]:=1; m[8]:=5; m[9]:=6; m[10]:=8;
for var i := 1 to 10 do
if m[i] = m.max then m[i]:= 0;
writeln(m);
end.
№3)
const n = 10;
var
a: array[1..n] of integer;
i, k, tmp: integer;
begin
for i := 1 to n do a[i] := random(0, 1);
writeln('Массив: ', a);
for i := 1 to n - 1 do
for k := 1 to n - i do
if a[k] > a[k + 1] then begin
tmp := a[k];
a[k] := a[k + 1];
a[k + 1] := tmp;
end;
writeln(a);
end.
№5)
const n = 10;
var
a: array[1..n] of integer;
a1, a2: array[1..n div 2] of integer;
i, k, tmp: integer;
begin
for i := 1 to n do a[i] := random(-10, 10);
writeln('Исходный массив: ',a);
for i := 1 to n div 2 do a1[i] := a[i];
for i := (n div 2 + 1) to n do a2[i - n div 2] := a[i];
for i := 1 to n div 2 - 1 do
for k := 1 to n div 2 - i do
if a1[k] > a1[k + 1] then begin
tmp := a1[k];
a1[k] := a1[k + 1];
a1[k + 1] := tmp;
end;
for i := 1 to n div 2 - 1 do
for k := 1 to n div 2 - i do
if a2[k] < a2[k + 1] then begin
tmp := a2[k];
a2[k] := a2[k + 1];
a2[k + 1] := tmp;
end;
for i := 1 to n do
if i <= 5 then a[i] := a1[i]
else a[i] := a2[i - n div 2];
writeln('Выходной массив: ', a);
end.
1)
a = int(input())
b = int(input())
for i in range(a, b+1):
if i % ... == 0 and i % ... != 0:
...
print(...)
2)
a = int(input())
x = a*2
n = 0
while a < x:
a = a + (a * 0.1)
n += 1
print(n/4)
3)
sum = 0
for i in range(100):
a = int(input())
if a < 0 and a % 2 != 0:
sum += a
print(a)
4)
a = input()
if a.count('0') != 0:
print('est`')
else:
print('net')
5)
p = int(input())
n = int(input())
c = 0
for i in range(n):
a = int(input())
if a > p:
c += 1
print(c)
6)
n = int(input())
c = 0
for i in range(n):
a = int(input())
if a % 10 == 5:
c += 1
print(c)
7)
a = int(input())
b = int(input())
n = int(input())
c = 0
for i in range(n):
x = int(input())
if a <= x <= b:
c += 1
print(c)
8)
n = int(input())
c = 0
sum = 0
for i in range(n):
x = float(input())
if x > 10:
sum += x
c += 1
print(x / c)
9)
c = 0
while True:
a = int(input())
if a == 0:
break
if a % 2 == 0:
c += 1
print(c)
10)
n = int(input())
c = 0
sum = 0
for i in range(n):
x = float(input())
if x < 10:
sum += x
c += 1
print(x / c)
11)
n = int(input())
c = 0
for i in range(n):
x = int(input())
if x % 10 == 3:
c += 1
print(c)
12)
x = input()
if x.count('4') != 0:
print('yes')
else:
print('no')