Программа:
Pascal:
№1)
var arr: array[1..10] of integer;
begin
for var i := 1 to 10 do arr[i] := random(100);
writeln(arr);
end.
№2)
const N = 15;
var arr: array[1..N] of integer;
i, tmp: integer;
for i := 1 to 15 do arr[i] := random(100);
for i:=1 to n div 2 do begin
tmp := arr[i];
arr[i] := arr[N - i + 1];
arr[N - i + 1]:= tmp;
end;
№3)
const N = 20;
var
arr: array[1..N] of integer;
i, tmp, j: integer;
for i := 1 to N do readln(arr[i]);
for i := 1 to N - 1 do
for j := 1 to N - i do
if (arr[j] > arr[j+1]) then begin
tmp := arr[j];
arr[j] := arr[j+1];
arr[j+1] := tmp;
Программа:
Pascal:
№1)
var arr: array[1..10] of integer;
begin
for var i := 1 to 10 do arr[i] := random(100);
writeln(arr);
end.
№2)
const N = 15;
var arr: array[1..N] of integer;
i, tmp: integer;
begin
for i := 1 to 15 do arr[i] := random(100);
writeln(arr);
for i:=1 to n div 2 do begin
tmp := arr[i];
arr[i] := arr[N - i + 1];
arr[N - i + 1]:= tmp;
end;
writeln(arr);
end.
№3)
const N = 20;
var
arr: array[1..N] of integer;
i, tmp, j: integer;
begin
for i := 1 to N do readln(arr[i]);
writeln(arr);
for i := 1 to N - 1 do
for j := 1 to N - i do
if (arr[j] > arr[j+1]) then begin
tmp := arr[j];
arr[j] := arr[j+1];
arr[j+1] := tmp;
end;
writeln(arr);
end.
DIM x AS SINGLE, y AS SINGLE
CLS
INPUT "Vvedite a,b,h: ", a, b, h
FOR x = a TO b STEP h
y = 1 / 2 * LOG(x ^ 2) + 1 / x ^ 2 + 2 - 1 / 2 * LOG(2) / 3
PRINT "x="; x, "y="; y
NEXT x
END
Тестовое решение:
Vvedite a,b,h: 2.7,8.4,0.5
x= 2.7 y= 3.014901
x= 3.2 y= 3.145283
x= 3.7 y= 3.265854
x= 4.2 y= 3.376249
x= 4.7 y= 3.477307
x= 5.2 y= 3.570116
x= 5.7 y= 3.65572
x= 6.2 y= 3.735039
x= 6.7 y= 3.80886
x= 7.2 y= 3.877846
x= 7.7 y= 3.942562
x= 8.2 y= 4.003482