Problem 1:
Write a FORTRAN 90 subroutine named compare that takes as its rst argument (named r) a row
subscript (between 1 and DIM inclusive). The second argument is an integer array with DIM rows
and NDATA columns. The third and fourth arguments are used to return two integer values as
described below. The subroutine source code is in a module in a separate le from the le containing
the main program source code. The subroutine compare calculates the sum of the values in row r.
The subroutine compare then nds the number of rows with the row sum greater than the sum for
row r, and the number of rows with sum less than or equal to the sum of row r (exclusive of row r),
returning these counts using the third and fourth arguments of compare. The main program takes
input from the keyboard to indicate the speci c row index passed to compare as its rst argument.
Elements in the matrix are generated in a column major manner as pseudo random integer values
between -10 and 10 inclusive. Do not change the starting seed from the default in the FORTRAN
90 compiler. The main program prints this matrix in a neatly formatted manner along with the
values returned by the subroutine compare. Provide test results for the user input of r=1, r=DIM,
and r=4. Use values for DIM and NDATA of 6 and 5 respectively.


0 comments