7
8
1: 8. .
: .
, , 1
1
x, k | integer | |
a,b | integer | |
d | integer | |
flag | boolean | / |
1.3
. 1
Program prostie_chisla;
var x, k: integer; a, b: integer;
Function prost (y: integer): boolean;
var d, i: integer; flag: boolean;
Begin
d:=0; flag:=false;
for i:=2 to y-1 do if y mod i=0 then d:=d+1;
if d=0 then flag:=true;
prost:=flag; end;
Begin
writeln ('Vvedite granici intervala'); readln (a, b);
begin
writeln ('Prostie chisla');
for x:=a to b do
begin
if prost (x) then
begin
write (' ',x);
end; end; end;
readln;
End.
, . .
1:
Vvedite granici interval: 1 9
Prostie chisla:
1 3 5 7
2:
8. . , .
: random.
, , 2.
2
x1, x2, x3, y1, y2, y3 | real | |
s, smax | real | |
i | integer | |
n | integer |
1.3
. 2
Program ploshad_treugolnika;
procedure sum (x1, x2, x3, y1, y2, y3:real; var s:real);
begin
S:=(sqrt (sqr (x1+x2-x3)+sqr (y1+y2-y3))*sqrt (sqr (x2-x1)+sqr (y2-y1)))/2; end;
var x1,y1,x2,y2,x3,y3,s,smax:real;
i, n: integer;
Begin
randomize;
smax:=0;
for i:=1 to 2 d begin
writeln ('Koordinati virchin ',i,' treugolnika');
x1:=random(10); y1:=random(10);
writeln ('A (',x1:1:1,' ',y1:1:1,')');
x2:=random(10); y2:=random(10);
writeln ('B (',x2:1:1,' ',y2:1:1,')');
x3:=random(10); y3:=random(10);
writeln ('C (',x3:1:1,' ',y2:1:1,')');
sum (x1, x2, x3, y1, y2, y3, s);
if s>smax then n:=i;
if s>smax then smax:=s;
end;
writeln ('Macsimalnaya ploshad ',n,' treugolnika= ',smax:3:3);
readln;
End.
1:
Koordinati virchin 1 treugolnika
|
|
A (2,3)
B (1,2)
C (3,2)
Koordinati virchin 2 treugolnika
A (4,3)
B (1,1)
C (3,5)
Macsimalnaya ploshad 2 treugolnika= 35.6
3:
8. A, B C 4- . (ABC)^p.
: p .
, , 3.
3
real | ||
i, j | integer | |
n | integer | |
ab, abc, A,B,C | integer |
1.3
. 3
program umnoshenie_matric;
Type matrix=array[1..4,1..4] of integer;
var A,B,C,ab, abc:matrix;
j,i,p,n:integer;
procedure zapmatrix(var a:matrix);
begin
for i:=1 to 4 do
for j:=1 to 4 do
a[i,j]:=random(2)+1; end;
procedure vivmatrix (a:matrix);
begin
for i:=1 to 4 do begin
for j:=1 to 4 do
write(a[i,j]:4,' '); writeln;
end; writeln; end;
Begin
writeln('Matrica A: ');
zapmatrix(a); vivmatrix(a);
writeln('Matrica B: ');
zapmatrix(b); vivmatrix(b);
writeln('Matrica C: ');
zapmatrix(c); vivmatrix(c);
for i:=1 to 4 do begin
for j:=1 to 4 do begin
ab[i,j]:=a[i,j]*b[i,j]; abc[i,j]:=ab[i,j]*c[i,j];
end; end; end; readln;
begin
write ('Vvedite naturalnoe chislo= '); readln (p); writeln;
begin
for n:=1 to p-1 do begin
for i:=1 to 4 do begin
for j:=1 to 4 do begin abc[i,j]:=abc[i,j]*abc[i,j];
end; end; end; end; end;
begin
writeln; writeln ('Proizvedenie matrix na naturalnoe chislo');
for i:=1 to 4 do begin
for j:=1 to 4 do begin
write (abc[i,j]:4,' '); end;
writeln; end;
writeln; end; readln;
End.
, . .
1:
Matrica A:
1 2 2 1
2 1 2 1
1 2 2 2
2 1 2 1
Matrica B:
1 2 2 1
1 2 2 1
2 2 2 2
2 2 1 2
Matrica C:
2 2 2 2
1 2 1 2
1 2 2 1
2 2 2 1
Vvedite naturalnoe chislo= 2
Proizvedenie matrix na naturalnoe chislo
4 64 64 4
4 16 16 4
4 64 64 16
64 16 16 4