Thank you @Beliavsky. One very minor remark: the line
integer, parameter :: n = 10
was superfluous. Without that line the program still compiled, ran and gave the same output with gfortran and ifort.
Thank you @Beliavsky. One very minor remark: the line
integer, parameter :: n = 10
was superfluous. Without that line the program still compiled, ran and gave the same output with gfortran and ifort.