Hi folks
I've got this little bit of code going on...
... which pretty much does what i want it to do, but i can't get it to sort so that the litre are in numerical order.
Is there anyome out there that is kind enough to help?
Thanks in advance
I've got this little bit of code going on...
VB.NET:
Sub Main()
Dim litre As Double = 1, gallon As Double = 0, litre2 As Double = 0, gallon2 As Double = 0
Dim halfGallons As Integer = 0, prevHalfGallons As Integer = 0
Console.WriteLine("Conversion chart for Litres-Gallons")
Console.WriteLine("Litres Gallons")
While litre < 11
gallon = litre * 0.22
halfGallons = CInt((gallon * 2))
If halfGallons > prevHalfGallons Then
prevHalfGallons = halfGallons
gallon2 = halfGallons / 2
litre2 = gallon2 / 0.22
Console.WriteLine("{0:F2} {1:F2}", litre2, gallon2)
End If
Console.WriteLine("{0:F3} {1:F3}", litre, gallon)
litre += 1
End While
Console.ReadLine()
Is there anyome out there that is kind enough to help?
Thanks in advance