Lab Activity # 12

Implement a Fortran 90 program which has the following features:

 

  1. The program includes a run-time array A whose lower index is 1 and whose upper index N is to be read from the screen.
  2. The program asks the user to enter the size (i.e. the upper index of A which will be called N).
  3. After the user enters N, the program will ask the user to enter the elements of array A.
  4. After the user enters the elements of A, the program passes the array A to a non-recursive SUBROUTINE in order to sort it by the Selection Sort method. The SUBROUTINE returns A after being sorted. In other words, the input of the SBROUTINE is A and the output is “sorted” A. The SUBROUTINE has one argument only which is A. 
  5. After the subroutine sorts A and returns it, the program displays A.

 

Sample Run

 

================ Sample Run Starts Here: ================

Enter size of array A:

3

Enter elements of A. Notice that there are           3 of them.

4.2 –3.3 1.7

-3.300000         1.700000      4.200000

Press any key to continue

================ Sample Run Ends Here. ================

 

===================== End of Lab 12 =====================