uses crt; var a:array [1..10] of integer; x: real; i:integer; begin clrscr; x:=0; for i:=1 to 10 do readln(A[i]); for i:=1 to 10 do begin if (A[i]<0) or (A[i] mod 2=0) then x:=x+Sqr(A[i]); end; writeln; write(x); end.
2)
program two; uses crt; var a:array [1..52] of integer; x,i: integer; begin clrscr; x:=34; for i:=1 to 52 do begin A[i]:=1+x; x:=x+1; if (A[i] mod 7 =1)or (A[i] mod 7 =2) or (A[i] mod 7 =5) then writeln(A[i]); end; end.
3)
Program three; Uses crt; var n,x:integer; a,y:real; begin Clrscr; readln(a,n); for x:=1 to n do y:=x*a; writeln(y); end.
4)
Program four; Uses crt; var A:array [1..100] of integer; n,i,max,x:integer; begin clrscr; writeln('vvedite kol-vo elementov'); readln(n); writeln('Vvedite elementy'); for i:=1 to n do read(A[i]); for i:=1 to n do begin max:=A[1]; if (A[i] <0) and (A[i]>A[x]) then max:=A[i]; x:=i; end; writeln ('Naib',max,'nomer',x); end.
5)
Program abc; Uses crt; var S,a,b:integer; begin clrscr; S:=0; a:=1; b:=3; while a<98 do begin while b<100 do begin S:=S+b-a; a:=a+4; b:=b+4; end; end; writeln(s); end.
В паскале
1) program one;
uses crt;
var a:array [1..10] of integer;
x: real; i:integer;
begin
clrscr;
x:=0;
for i:=1 to 10 do
readln(A[i]);
for i:=1 to 10 do
begin
if (A[i]<0) or (A[i] mod 2=0) then
x:=x+Sqr(A[i]);
end;
writeln;
write(x);
end.
2)
program two;
uses crt;
var a:array [1..52] of integer;
x,i: integer;
begin
clrscr;
x:=34;
for i:=1 to 52 do
begin
A[i]:=1+x;
x:=x+1;
if (A[i] mod 7 =1)or (A[i] mod 7 =2) or (A[i] mod 7 =5)
then writeln(A[i]);
end;
end.
3)
Program three;
Uses crt;
var n,x:integer; a,y:real;
begin
Clrscr;
readln(a,n);
for x:=1 to n do
y:=x*a;
writeln(y);
end.
4)
Program four;
Uses crt;
var A:array [1..100] of integer;
n,i,max,x:integer;
begin
clrscr;
writeln('vvedite kol-vo elementov');
readln(n);
writeln('Vvedite elementy');
for i:=1 to n do
read(A[i]);
for i:=1 to n do
begin
max:=A[1];
if (A[i] <0) and (A[i]>A[x])
then max:=A[i];
x:=i;
end;
writeln ('Naib',max,'nomer',x);
end.
5)
Program abc;
Uses crt;
var S,a,b:integer;
begin
clrscr;
S:=0;
a:=1;
b:=3;
while a<98 do
begin
while b<100 do
begin
S:=S+b-a;
a:=a+4;
b:=b+4;
end;
end;
writeln(s);
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)
Объяснение: