+ 1

# How can i count Binary and Octal numbers in Ruby

How we can count Binary and Octal numbers in Ruby

3 Answers

+ 4

puts(010) # octal 8
puts(0b1000) # binary 8
in pube octal number is prefixed with a 0 and binary with 0b .

+ 1

Tnx I know it bro
i don't know how to change integers to binary and octal numbers

+ 1

https://rubyquicktips.com/post/18935873770/convert-between-number-bases-easily
binary is base 2
octal is base 8