Regela icon

Basic Array Sort

Regela | PRO | 03/13/18 12:24:49 PM UTC | 0 ⭐ | 10601 👁️ | Never ⏰ | []
FreeBasic |

460 B

|

None

|

0 👍

/

0 👎

DIM A(9) As Integer
DIM i As Integer
DIM j As Integer
DIM buff As Integer
DIM count As Integer = 0
A(0)=5
A(1)=3
A(2)=4
A(3)=2
A(4)=1
A(5)=6
A(6)=3
A(7)=2
A(8)=4
For j=0  to  8
    For i = 0 to 7 
        if A(i)>A(i+1) Then
            buff=A(i)
            A(i)=A(i+1)
            A(i+1)=buff
        End If
    Next
Next
For i = 0 to 7 
    print A(i)
    if A(i) <> A(i+1)then count=count+1 end if
Next
print A(8)
print "Count: ";Count

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎