Объяснение:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Program lab5;
Var
A: array [1..10,1..15] of real;
i, j, m, n: integer; s, p, min, max: real;
Begin
writeln('Введи m,n'); read(m,n);
writeln('Введи массив A');
for i:=1 to m do
for j:=1 to n do
read(A[i,j]);
s:=0; p:=1; min:=A[1,1]; max:=A[1,1];
for i:=1 to m do for j:=1 to n do
begin
s:=s+A[i,j]; p:=p*A[i,j];
if A[i,j]<min then min:=A[i,j];
if A[i,j]>max then max:=A[i,j];
end;
writeln('s=',s:10:3,' p=',p:10:3,
' min=',min:10:3,' max=',max:10:3);
End.
import turtle
from math import tan, sqrt, pi
def prepare(x, y, color):
turtle.penup()
turtle.goto(x, y)
turtle.pendown()
turtle.color(color)
turtle.begin_fill()
def draw_polygon(num_sides, side_length):
angle = 360.0 / num_sides
for i in range(num_sides):
turtle.forward(side_length)
turtle.right(angle)
turtle.end_fill()
def calc_s(num_sides, side_length):
return num_sides * side_length ** 2 / (4 * tan(pi/num_sides))
def calc_side(square):
return sqrt(4 * square * tan(pi/num_sides) / num_sides)
turtle.hideturtle()
turtle.speed(10)
colors = ['red', 'green', 'blue', 'cyan', 'magenta', 'black', 'yellow', 'pink', 'brown']
xcoords = [0, 150, -150, 150, -150, 270, -270, 270, -270]
ycoords = [0, 150, -150, -150, 150, 270, -270, -270, 270]
squares = []
numsides = []
for i in range(9):
num_sides = i + 3
square = round(calc_s(num_sides, 100), 2)
side_length = round(calc_side(10000), 3)
squares.append(square)
numsides.append(num_sides)
print("Углов:", num_sides, "была площадь:", square, "стала длина грани:", side_length,
"изменение в", round(side_length/100, 2), "раз")
prepare(xcoords[i], ycoords[i], colors[i])
draw_polygon(num_sides, side_length)
turtle.exitonclick()
print("Список количество углов:", numsides, end="")
print("Список площади:", squares)
Объяснение:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Program lab5;
Var
A: array [1..10,1..15] of real;
i, j, m, n: integer; s, p, min, max: real;
Begin
writeln('Введи m,n'); read(m,n);
writeln('Введи массив A');
for i:=1 to m do
for j:=1 to n do
read(A[i,j]);
s:=0; p:=1; min:=A[1,1]; max:=A[1,1];
for i:=1 to m do for j:=1 to n do
begin
s:=s+A[i,j]; p:=p*A[i,j];
if A[i,j]<min then min:=A[i,j];
if A[i,j]>max then max:=A[i,j];
end;
writeln('s=',s:10:3,' p=',p:10:3,
' min=',min:10:3,' max=',max:10:3);
End.
import turtle
from math import tan, sqrt, pi
def prepare(x, y, color):
turtle.penup()
turtle.goto(x, y)
turtle.pendown()
turtle.color(color)
turtle.begin_fill()
def draw_polygon(num_sides, side_length):
angle = 360.0 / num_sides
for i in range(num_sides):
turtle.forward(side_length)
turtle.right(angle)
turtle.end_fill()
def calc_s(num_sides, side_length):
return num_sides * side_length ** 2 / (4 * tan(pi/num_sides))
def calc_side(square):
return sqrt(4 * square * tan(pi/num_sides) / num_sides)
turtle.hideturtle()
turtle.speed(10)
colors = ['red', 'green', 'blue', 'cyan', 'magenta', 'black', 'yellow', 'pink', 'brown']
xcoords = [0, 150, -150, 150, -150, 270, -270, 270, -270]
ycoords = [0, 150, -150, -150, 150, 270, -270, -270, 270]
squares = []
numsides = []
for i in range(9):
num_sides = i + 3
square = round(calc_s(num_sides, 100), 2)
side_length = round(calc_side(10000), 3)
squares.append(square)
numsides.append(num_sides)
print("Углов:", num_sides, "была площадь:", square, "стала длина грани:", side_length,
"изменение в", round(side_length/100, 2), "раз")
prepare(xcoords[i], ycoords[i], colors[i])
draw_polygon(num_sides, side_length)
turtle.exitonclick()
print("Список количество углов:", numsides, end="")
print("Список площади:", squares)
Объяснение: