All pastes #62663 Raw Edit

Question C.1

public text v1 · immutable
#62663 ·published 2006-06-06 19:26 UTC
rendered paste body
program Search2Dimensional;

Var
Arry : Array[1..5,1..5] of Integer;
Temp,TempM : Integer;
X,Y,mit,mat : integer;

Begin
  Temp := -maxint;
  TempM :=maxint;
  mit := 0;
  mat := 0;


  For X:= 1 to 5 do
  For Y:= 1 to 5 do
  Read(Arry[X,Y]);



 For X:= 1 to 5 do
  For Y:= 1 to 5 do
    Begin
    If Arry[X,Y] > Temp then Temp:= Arry[X,Y];
    If Arry[X,Y] < TempM then TempM:= Arry[X,Y];
    End;

  For X:= 1 to 5 do
  For Y:= 1 to 5 do
    Begin
    If Arry[X,Y] = Temp then mat := mat + 1;
    If Arry[X,Y] = TempM then mit := mit+1;
    End;

 Writeln('Maximum is ',Temp,' and occurs ',mat,' times.');
 Writeln('Minimum is ',TempM,' and occurs ',mit,' times.');


End.