Decimal To Octal

This algorithm converts decimal numbers to octal numbers.



									Public Shared Function DecimalToOctal(dec As Integer) As String
	If dec < 1 Then Return "0"

	Dim octStr As String = String.Empty

	While dec > 0
		octStr = octStr.Insert(0, (dec Mod 8).ToString())
		dec = Int(dec / 8)
	End While

	Return octStr
End Function
								


Example

									Dim data = 667887
Dim value = DecimalToOctal(data)
								


Output

									2430357