FORTRAN语言:用冒泡法排序将N个数(即动态一维数组)从大到小排列……

2024-11-27 10:42:33
推荐回答(1个)
回答1:

real*8 :: a(n)
real*8 :: temp
integer :: i,j
do i=1,n-1
do j=i+1,n
if (a(i) .lt. a(j)) then
temp = a(i)
a(i) = a(j)
a(j) = temp
endif
enddo
enddo