mirror of
https://github.com/TheAlgorithms/Ruby
synced 2025-01-28 19:58:20 +01:00
Update iterative_decimal_to_binary.rb
This commit is contained in:
parent
1fb0258c8e
commit
446b0e3085
1 changed files with 1 additions and 1 deletions
|
@ -6,7 +6,7 @@ def decimal_to_binary(n)
|
|||
bin << n % 2
|
||||
n = n / 2
|
||||
end
|
||||
return bin.reverse.join
|
||||
bin.reverse.join
|
||||
end
|
||||
|
||||
puts 'Binary value of 4 is ' + decimal_to_binary(4).to_s
|
||||
|
|
Loading…
Add table
Reference in a new issue