dec to binary....look here for great prizes!

mick_robo
04-03-2003, 09:19 PM
this is my function to convert a decimal no. to a binary no.
is there a way that i can use a do, loop command rather than the while, wend command.

Function tobinary(x As Integer) As String
Dim s As String
If x = 0 Then
s = "0"
Else
s = ""
While x <> 0
s = (x Mod 2) & s
x = Int(x / 2)
Wend
End If
tobinary = s
End Function

thanks!

mick_robo
04-03-2003, 09:22 PM
this is my function to convert a decimal no. to a binary no.
is there a way that i can use a do, loop command rather than the while, wend command.

Function tobinary(x As Integer) As String
Dim s As String
If x = 0 Then
s = "0"
Else
s = ""
While x <> 0
s = (x Mod 2) & s
x = Int(x / 2)
Wend
End If
tobinary = s
End Function

thanks!

mick_robo
04-03-2003, 09:36 PM
i worked it out, so dont worry about replying. anyone......anyone........anyone. oh well. thanks be to me, thanks be to me!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum