109.1.. Učitati matricu i naći u kojem redu je najmanja aritmetička sredina.
Opis programa:
Listing programa:
program p10901197;
uses wincrt;
var
i,j,n,m,zbir,br,minred: integer;
min:real;
x:array[1..15,1..15] of integer;
as:array[1..15] of real;
begin
write('unesi dimenzije matrice n, m ');
readln(n,m);
for i:=1 to n do
for j:=1 to m do
begin
write('x[',i,',',j,']=');
readln(x[i,j]);
end;
for i:=1 to n do
begin
for j:=1 to m do
begin
zbir:=zbir + x[i,j];
br:=br + 1;
end;
as[i]:=zbir/br;
br:=0;
zbir:=0;
end;
min:=as[1];
minred:=1;
for i:=1 to n do
begin
if as[i] < min then
begin
min:=as[i];
minred:=i;
end;
end;
writeln('najmanja aritmeticka sredina je u ',minred,'. redu');
end.
Izvođenje programa:
Index
|
|