Вопрос задан 27.04.2019 в 01:57. Предмет Информатика. Спрашивает Борозна Павел.

дан массив 5*6. Найти среднее арифметическое в каждой строке. Результаты положить в одномерный

массив. паскаль
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Иваночко Ваня.
Program z;
var
s,i,j,n,m:integer;
a:array [1..100,1..100] of integer;
b:array [1..100] of real;
begin
n:=5; m:=6;
for i:=1 to n do
for j:=1 to m do
begin
writeln ('vvedi elementy');
readln (a[i,j]);
end;
for i:=1 to n do
begin
for j:=1 to m do
begin
write (a[i,j]:5);
end;
writeln;
end;
for i:=1 to n do
begin
s:=0;
for j:=1 to m do
begin
s:=s+a[i,j];
end;
b[i]:=s/m;
end;
for i:=1 to n do
writeln (b[i]:5:1);
readln;
end.
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Finding the Arithmetic Mean in Each Row of a 5x6 Array in Pascal

To find the arithmetic mean in each row of a 5x6 array in Pascal and store the results in a one-dimensional array, you can use the following approach:

1. Initialize the 5x6 Array: - Create a 5x6 array and populate it with the given values.

2. Calculate the Arithmetic Mean in Each Row: - Iterate through each row of the array and calculate the arithmetic mean for each row.

3. Store the Results in a One-Dimensional Array: - Store the calculated arithmetic means of each row in a one-dimensional array.

Let's proceed with the implementation.

Pascal Code for Finding Arithmetic Mean in Each Row

```pascal program ArithmeticMean;

var arr: array[1..5, 1..6] of Integer; means: array[1..5] of Real; i, j: Integer;

begin { Initialize the 5x6 array } { Replace the values below with the actual values of the 5x6 array } arr[1, 1] := 1; arr[1, 2] := 2; arr[1, 3] := 3; arr[1, 4] := 4; arr[1, 5] := 5; arr[1, 6] := 6; arr[2, 1] := 7; arr[2, 2] := 8; arr[2, 3] := 9; arr[2, 4] := 10; arr[2, 5] := 11; arr[2, 6] := 12; arr[3, 1] := 13; arr[3, 2] := 14; arr[3, 3] := 15; arr[3, 4] := 16; arr[3, 5] := 17; arr[3, 6] := 18; arr[4, 1] := 19; arr[4, 2] := 20; arr[4, 3] := 21; arr[4, 4] := 22; arr[4, 5] := 23; arr[4, 6] := 24; arr[5, 1] := 25; arr[5, 2] := 26; arr[5, 3] := 27; arr[5, 4] := 28; arr[5, 5] := 29; arr[5, 6] := 30;

{ Calculate the arithmetic mean in each row } for i := 1 to 5 do begin means[i] := 0; for j := 1 to 6 do begin means[i] := means[i] + arr[i, j]; end; means[i] := means[i] / 6; end;

{ Display the calculated arithmetic means } for i := 1 to 5 do begin writeln('Arithmetic mean of row ', i, ': ', means[i]:0:2); end; end. ```

In this Pascal program, we first initialize the 5x6 array with the given values. Then, we calculate the arithmetic mean in each row and store the results in the `means` array. Finally, we display the calculated arithmetic means for each row.

This program will output the arithmetic mean of each row of the 5x6 array.

0 0

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

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

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