Вопрос задан 20.02.2019 в 20:58. Предмет Информатика. Спрашивает Клименко Миша.

составить программу,которая определяет сколько раз встречается в таблице а максимальное по величине

число.Pascal.Массивы.Помогите,пожалуйста
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Быченкова Екатерина.

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.

0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

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.

0 0

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос