How can i count Binary and Octal numbers in Ruby | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can i count Binary and Octal numbers in Ruby

How we can count Binary and Octal numbers in Ruby

17th Jun 2021, 5:54 PM
Yahya Jamil
3 Answers
+ 4
puts(010) # octal 8 puts(0b1000) # binary 8 in pube octal number is prefixed with a 0 and binary with 0b .
17th Jun 2021, 6:01 PM
Prashanth Kumar
Prashanth Kumar - avatar
+ 1
Tnx I know it bro i don't know how to change integers to binary and octal numbers
17th Jun 2021, 6:05 PM
Yahya Jamil
17th Jun 2021, 7:03 PM
visph
visph - avatar