Hello I'm new here i just needed some help with a program i am working at. I take a specific data apply some boundary conditions and then on the results i try to sort it in ascending order. I try to print my results all the way so i can know where I'm wrong if I'm wrong. My problem is that even though my original array doesn't contain any zero elements my sorted one does and a lot of them. Any help would be appreciated. Here is the code
DO k=1,927550
IF (RADIUSabs(k) <= 1000000 .and. RADIUSabs(k)/=0) THEN
count2=count2+1
END IF
END DO
write(6,*) count2
DO k=1,927550
IF (RADIUSabs(k) <= 1000000 .and. RADIUSabs(k)/=0) THEN
RADIUSabs1(k)=RADIUSabs(k)
WRITE(6,*) RADIUSabs1(k)
END IF
END DO
WRITE(6,*) "THIS IS RADIUSABS UNSORTED WITH LESS ELEMENTS"
DO k=1,count2-1
DO m=k+1,count2
IF(RADIUSabs1(k)>RADIUSabs1(m)) THEN
temp=RADIUSabs1(m)
RADIUSabs1(m)=RADIUSabs1(k)
RADIUSabs1(k)=temp
END IF
END DO
END DO
DO k=1,count2
write(6,*) RADIUSabs1(k)
END DO
write(6,*) " =sorted array"
DO k=1,927550
IF (RADIUSabs(k) <= 1000000 .and. RADIUSabs(k)/=0) THEN
count2=count2+1
END IF
END DO
write(6,*) count2
DO k=1,927550
IF (RADIUSabs(k) <= 1000000 .and. RADIUSabs(k)/=0) THEN
RADIUSabs1(k)=RADIUSabs(k)
WRITE(6,*) RADIUSabs1(k)
END IF
END DO
WRITE(6,*) "THIS IS RADIUSABS UNSORTED WITH LESS ELEMENTS"
DO k=1,count2-1
DO m=k+1,count2
IF(RADIUSabs1(k)>RADIUSabs1(m)) THEN
temp=RADIUSabs1(m)
RADIUSabs1(m)=RADIUSabs1(k)
RADIUSabs1(k)=temp
END IF
END DO
END DO
DO k=1,count2
write(6,*) RADIUSabs1(k)
END DO
write(6,*) " =sorted array"