

{
PROGRAMMED BY   : MOHAMMAD ALJADA
DOWNLOADED FROM : WWW.GEOCITIES.COM/MOHJADA
PROGRAM         : Max & Min
}

USES WINCRT;

VAR ARR:ARRAY[1..100] OF INTEGER;
    MAX,MAXP,MIN,MINP,I,N:INTEGER;


BEGIN

     WRITE('INPUT NUMBER OF ITEMS :');
     READLN(N);

     FOR I:=1 TO N DO
     BEGIN
     WRITE('INPUT ITEM ',I,' :');
     READLN(ARR[I]);
     END;

     MIN:=ARR[1];
     MAX:=ARR[1];
     MAXP:=1;
     MINP:=1;

     FOR I:=1 TO N DO
     BEGIN

          IF ARR[I] > MAX THEN
          BEGIN
          MAX:=ARR[I];
          MAXP:=I;
          END;

          IF ARR[I] < MIN THEN
          BEGIN
          MIN:=ARR[I];
          MINP:=I;
          END;

     END;


     WRITELN('THE MAXIMUM NUMBER IS : ',MAX);
     WRITELN('ITS POSITION          : ',MAXP);
     WRITELN('THE MINIMUM NUMBER IS : ',MIN);
     WRITELN('ITS POSITION          : ',MINP);
END.

      