Decimal To Binary

This algorithm converts decimal numbers to binary numbers.



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

	Dim binStr As String = String.Empty

	While dec > 0
		binStr = binStr.Insert(0, (dec Mod 2).ToString())
		dec = Int(dec / 2)
	End While

	Return binStr
End Function
								


Example

									Dim data = 6207166
Dim value = DecimalToBinary(data)
								


Output

									10111101011011010111110