Var a:array [1..10, 1..10] of integer; i, j, max, min, imin, imax, jmin, jmax:integer; begin imax:=0; imin:=0; jmax:=0; jmin:=0; max:=-maxint; min:=maxint; for i:=1 to 10 do begin for j:=1 to 10 do begin a[i,j]:=random(89)+10; write(a[i,j],' '); if a[i,j]<min then begin min:=a[i,j]; imin:=i; jmin:=j; end; if a[i,j]>max then begin max:=a[i,j]; imax:=i; jmax:=j; end; end; writeln; end; writeln; writeln('Максимальный элемент:',max); writeln('Его индекс ',imax,' ',jmax); writeln('Минимальный элемент:',min); writeln('Его индекс ',imin,' ',jmin); end.
i, j, max, min, imin, imax, jmin, jmax:integer;
begin
imax:=0; imin:=0; jmax:=0; jmin:=0;
max:=-maxint; min:=maxint;
for i:=1 to 10 do
begin
for j:=1 to 10 do
begin
a[i,j]:=random(89)+10;
write(a[i,j],' ');
if a[i,j]<min then
begin
min:=a[i,j];
imin:=i;
jmin:=j;
end;
if a[i,j]>max then
begin
max:=a[i,j];
imax:=i;
jmax:=j;
end;
end;
writeln;
end;
writeln;
writeln('Максимальный элемент:',max);
writeln('Его индекс ',imax,' ',jmax);
writeln('Минимальный элемент:',min);
writeln('Его индекс ',imin,' ',jmin);
end.
1-е Задание:
Program PRG;
var
a, b, c, e, x, y, num, den: real;
function calc( a, b, c, e, x: real ): real;
begin
num := ((( abs(sin(x ** 3))) + a) * (e ** a));
den := (exp(ln((b ** 2) + (c ** 2)) / 3));
y := num / den;
Result := y;
write('Answer is: ', y);
writeln();
end;
function entNums (): real;
begin
write ('Enter a: '); readln (a);
write ('Enter b: '); readln (b);
write ('Enter c: '); readln (c);
write ('Enter e: '); readln (e);
write ('Enter x: '); readln (x);
writeln();
end;
begin
entNums();
calc( a, b, c, e, x );
end.
2-е Задание:
Program
var wallWid, wallHeight, winHeight, winWid, doorWid, doorHeight, fourWalls, door, win, total: real;
function getFourWalls( wallWid, wallHeight: real ): real;
begin
fourWalls := (wallHeight * wallWid) * 4;
Result := fourWalls;
end;
function getDoorSize( doorHeight, doorWid: real ): real;
begin
door := doorHeight * doorWid;
Result := door;
end;
function getWinSize( winHeight, winWid: real ): real;
begin
win := winHeight * winWid;
Result := win;
end;
function getWalls(): real;
begin
total := (fourWalls - ( door + win )) / 10000;
Result := total;
write(' You need ', total, ' m² of wallpaper!');
writeln();
end;
function enterSizes(): real;
begin
writeln();
write (' Enter width of the wall (in cm): '); readln (wallWid);
write (' Enter height of the wall (in cm): '); readln (wallHeight);
write (' Enter width of the window (in cm): '); readln (winWid);
write (' Enter hight of the window (in cm): '); readln (winHeight);
write (' Enter width of the door (in cm): '); readln (doorWid);
write (' Enter height of the doot (in cm): '); readln (doorHeight);
writeln();
end;
begin
enterSizes();
getFourWalls( wallWid, wallHeight );
getDoorSize( doorHeight, doorWid );
getWinSize( winHeight, winWid );
getWalls();
end.
Блок-схемы легко можешь составить глядя на коды программ)
Удачи)