command
Version:
v0.0.0-...-9d64b2e
Opens a new window with list of versions in this module.
Published: Jan 25, 2021
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Binary representation of a given number
Source: GeeksforGeeks
Write a program to print Binary representation of a given number.
Algorithm
Recursive using bitwise operator
- Check n > 1
- right shift the number by 1 bit and recursive call the function
- Print the bits of number
Alternate solution is to use fmt Go package to transform decimal to binary:
fmt.Printf("The binary of the %d is: %b\n", x, x)
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.