PROGRAM ny
IMPLICIT NONE
INTEGER::n,i
INTEGER,ALLOCATABLE::a(:),b(:)
READ*,n
ALLOCATE (a(n),b(n))
READ*,a
DO i=1,n
b(i)=MAXVAL(a)
a(MAXLOC(a))=MINVAL(a)
END DO
PRINT*,b
END
PROGRAM ny
IMPLICIT NONE
INTEGER::n,i
INTEGER,ALLOCATABLE::a(:),b(:)
READ*,n
ALLOCATE (a(n),b(n))
READ*,a
DO i=1,n
b(i)=MAXVAL(a)
a(MAXLOC(a))=MINVAL(a)
END DO
PRINT*,b
END