mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
635 B
23 lines
635 B
6 years ago
|
## printbits
|
||
6 years ago
|
|
||
6 years ago
|
### Instructions
|
||
6 years ago
|
|
||
5 years ago
|
Write a program that takes a number as argument, and prints it in binary value **without a newline at the end**.
|
||
|
|
||
5 years ago
|
- If the the argument is not a number the program should print `00000000`.
|
||
5 years ago
|
|
||
5 years ago
|
### Usage :
|
||
5 years ago
|
|
||
|
```console
|
||
|
student@ubuntu:~/printbits$ go build
|
||
|
student@ubuntu:~/printbits$ ./printbits 1
|
||
|
00000001student@ubuntu:~/printbits$
|
||
|
student@ubuntu:~/printbits$ ./printbits 192
|
||
|
11000000student@ubuntu:~/printbits$
|
||
|
student@ubuntu:~/printbits$ ./printbits a
|
||
|
00000000student@ubuntu:~/printbits$
|
||
|
student@ubuntu:~/printbits$ ./printbits 1 1
|
||
|
student@ubuntu:~/printbits$ ./printbits
|
||
|
student@ubuntu:~/printbits$
|
||
5 years ago
|
```
|