!find smallest number
subroutine findsmall(z, i, j, small, count0, y)
implicit none
integer:: i, j, small, count0
real:: z(121), temp, y(121)
300 format(//, t1, 9(f6.2, 2x))
read(*, 300) z(1:121)
do i=1, 120, 1
small = i
do j=i+1, 121, 1
if (z(small) > z(j)) then
small = j
end if
end do
temp = z(i)
z(i) = z(small)
z(small) = temp
y(i) = z(i)
count0 = count0 + 1
end do
print 300, y(1:121)
print*, count0
end subroutine findsmall
This is my subroutine. It accepts input data from a print statement that prints generated random numbers. After the print occurs, the input needs to be read into the array, an attempt I've mead occurs on line 26 which is:
read(*, 300) z(1:121)
I get an error that says 'fortran runtime error: bad value during floating point read'. I don't understand what's wrong here, it sorted before with mixed results. I changed a couple things such as moving the temp from integer to real in order to keep the hundredths place digits, and now fubar, fubar everywhere.