PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 25 → Converter Decimal em Binário (Convert Decimal to binary)
Converter Decimal em Binário (Convert Decimal to binary)
Started by JOSE ELIELSON SILVA, Jul., 23 2015 11:31 AM - No answer
Registered member
14 messages
Popularité : +5 (7 votes)
Posted on July, 23 2015 - 11:31 AM
// by Jose Elielson
// converter dec -> bin
x is int = edit_decimal
r is int = 0
y is int = 0
b is string = ""

IF x > 1

LOOP
y = IntegerPart(x/2)

r = x - (y*2)

b = NumToString(r) + b

IF y = 1 THEN
b = "1" + b
BREAK
END
x = y
END
ELSE
b = NumToString(x)
END

Info(b)