program bubble_test
implicit none
integer, dimension(6) :: vec
integer :: temp, bubble, lsup, j
read *, vec !the user needs to put 6 values on the array
lsup = 6 !lsup is the size of the array to be used
do while (lsup > 1)
bubble = 0 !bubble in the greatest element out of order
do j = 1, (lsup-1)
if (vec(j) > vec(j+1)) then
temp = vec(j)
vec(j) = vec(j+1)
vec(j+1) = temp
bubble = j
endif
enddo
lsup = bubble
enddo
print *, vec
end program
Lisp: The first high-level functional languageWednesday, 12 February 2020
Fortran & Lisp: The First High-level Structured Language and Functional Language
Fortran: The first high-level structured language
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment