
составить программу,которая определяет сколько раз встречается в таблице а максимальное по величине
число.Pascal.Массивы.Помогите,пожалуйста

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

const n=100;
m=100;
var A: array[1..n,1..m] of integer;
i,j,maxi,maxj,k: integer;
begin
randomize;
for i := 1 to n do begin
for j := 1 to m do begin
A[i,j] := random(100);
end;
end;
maxi := 1;
maxj := 1;
for i := 1 to n do begin
for j := 1 to m do begin
if (A[i,j] > A[maxi,maxj]) then begin
maxi := i;
maxj := j;
end;
end;
end;
k := 0;
for i := 1 to n do begin
for j := 1 to m do begin
if (A[i,j] == A[maxi,maxj]) then k := k + 1;
end;
end;
writeln('k = ', k);
end.



Program in Pascal to Determine the Maximum Occurrence of a Number in a Table
Here's a program in Pascal that determines how many times the maximum number occurs in a table:
```pascal program MaxOccurrence; var arr: array[1..100] of integer; // Assuming the table has a maximum of 100 elements max, count, i: integer; begin // Initialize the array with some values (you can modify this part based on your specific table) for i := 1 to 100 do arr[i] := i; // Replace 'i' with the actual values from your table // Find the maximum number in the array max := arr[1]; for i := 2 to 100 do begin if arr[i] > max then max := arr[i]; end; // Count the occurrences of the maximum number count := 0; for i := 1 to 100 do begin if arr[i] = max then count := count + 1; end; // Display the result writeln('The maximum number in the table is: ', max); writeln('It occurs ', count, ' times.'); end. ```
This program initializes an array with values from the table, finds the maximum number in the array, and then counts how many times the maximum number occurs.
Note: You may need to modify the program to match the specific structure and content of your table.


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