
Var k, m, term: integer; Dat: array(1..8] of integer; Begin Dat [1] := 7; Dat [2] := 7; Dat [3]
:= 6; Dat (4) != 8; Dat (5] := 4; Dat[6] := 5; Dat [7] := 4; Dat [8] := 7; m :- Dat(1); term := 1; for k:= 2 to 8 do if Dat [k] begin m := Dat[k); term := k; end; writeln(term); End. Var k, m, day: integer;

Ответы на вопрос

Ответ:
Ладно, побуду добрым.
Если там так Dat(k) > m
for k:- 2 to 8 do
if Dat(k) > m then
begin
m :- Dat (k):
term :- k;
end;
То ответ такой:
Тут мы ищем максимальный элемент и запоминаем его позицию в переменной term
самые большие в массиве-это 8
И первая 8 имеет номер 4, значит ответ:4
Если же там так:
for k:- 2 to 8 do
if Dat(k) < m then
begin
m :- Dat (k):
term :- k;
end;
То ответ такой:
Тут мы ищем минимум элемент и запоминаем его позицию в переменной term
самые большие в массиве-это 4
И первая 4 имеет номер 5 значит ответ:5
Если же там так:
for k:- 2 to 8 do
if Dat(k) <= m then
begin
m :- Dat (k):
term :- k;
end;
То ответ такой:
Тут мы ищем минимум элемент и запоминаем его позицию в переменной term
самые большие в массиве-это 4
И последняя 4 имеет номер 7 значит ответ:7



It seems like there are some syntax errors in the provided code. I'll correct them and explain what the code does.
Corrected code:
pascalVar k, m, term: integer; Dat: array[1..8] of integer; Begin Dat[1] := 7; Dat[2] := 7; Dat[3] := 6; Dat[4] := 8; Dat[5] := 4; Dat[6] := 5; Dat[7] := 4; Dat[8] := 7; m := Dat[1]; term := 1; for k := 2 to 8 do begin if Dat[k] > m then begin m := Dat[k]; term := k; end; end; writeln(term); End.
Explanation:
- The code declares three variables
k
,m
, andterm
, all of which are of the integer data type. - It also declares an array
Dat
with eight elements indexed from 1 to 8, each of which holds an integer value. - The values of elements in the
Dat
array are initialized. - The variable
m
is assigned the value of the first element in the arrayDat[1]
, and the variableterm
is initialized to 1. - The
for
loop iterates fromk = 2
tok = 8
. - Inside the loop, it checks if the value of
Dat[k]
is greater than the current value ofm
. - If
Dat[k]
is greater thanm
, it updates the value ofm
toDat[k]
and also updates the value ofterm
to the current value ofk
. - After the loop completes, the program prints the value of
term
.
The code essentially finds the index of the highest value in the Dat
array and prints that index. Keep in mind that in Pascal, array indices start from 1, so the result will be in the range of 1 to 8 (inclusive), depending on the position of the highest value in the array.


Похожие вопросы
Топ вопросов за вчера в категории Информатика
Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili