0% found this document useful (0 votes)
13 views1 page

Bubble Array

The document contains a Visual Basic program that prompts the user to enter ten numbers and stores them in an array. It then prints the first five numbers and attempts to sort the entire array in descending order using a bubble sort algorithm. The sorting process continues until no more swaps are needed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

Bubble Array

The document contains a Visual Basic program that prompts the user to enter ten numbers and stores them in an array. It then prints the first five numbers and attempts to sort the entire array in descending order using a bubble sort algorithm. The sorting process continues until no more swaps are needed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Imports System.

Console
Module Module1

Sub Main()
Dim numbersarray(9), count As Integer
For count = 0 To 9
Write("enter number" & count + 1)
numbersarray(count) = ReadLine()
Next
For count = 0 To 4
WriteLine(numbersarray(count))
Next

Dim swapped As Boolean


Dim temp, top As Integer
top = 9

Do
swapped = False
For x = 0 To top
For y = 0 To top - 1
If numbersarray(y) < numbersarray(y + 1) Then
temp = numbersarray(y)
numbersarray(y) = numbersarray(y + 1)
numbersarray(y + 1) = temp
swapped = True
End If
Next y
Next x
Loop Until swapped = True

End Sub

End Module

You might also like