Modular Approach –2: contd.-1
      subroutine input(a,b,nsp,nsd)
c-------------------------------
      dimension a(nsp), b(nsp)
c
      print *, ' '
      print *, ' This program adds 2 arrays of real numbers'
      print *, ' saved in a file named add2.inp'
c  Declare open the input file
      open (unit=1, file='add2.inp', access='sequential',
     .action='read', status='old', form='formatted')
c
c  Now read the arrays
c  first the count of students
      read(1, *) nsd
      print *, ' '
      print *, ' Student count, nsd=',nsd
c
c then a count controlled loop over the two arrays
      do 10 i=1,nsd
      read(1,*) a(i),b(i)
   10 continue
c
      return
      end