Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program zsjopx
- implicit none
- integer i,j,x,y,index,index2
- integer a(10)
- integer err
- integer,allocatable :: b(:) !偶
- integer,allocatable :: c(:) !奇
- do while(.true.)
- read(*,*,iostat=err) a
- if(err/=0) exit
- x=0
- y=0
- do i=1,10
- if(mod(a(i),2)==0)then
- x=x+1
- end if
- end do
- y=10-x
- allocate(b(x))
- allocate(c(y))
- b=0
- c=0
- index = 1
- index2 = 1
- do j = 1, 10
- if (mod(a(j),2)==0) then
- b(index) = a(j)
- index = index+1
- else
- c(index2)=a(j)
- index2 = index2+1
- end if
- end do !将数组分类拆开
- call Bubble_sort(b,x)
- call Bubble_sort(c,y)
- c(1:y)=c(y:1:-1)
- write(*,"(I0\' ')")c,b
- deallocate(b)
- deallocate(c)
- end do
- end program zsjopx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement