Browse Source

printbits readme for the exams

pull/292/head
lee 5 years ago committed by Christopher Fremond
parent
commit
52bfbb7d5d
  1. 31
      subjects/printbits.en.md

31
subjects/printbits.en.md

@ -2,18 +2,21 @@
### Instructions
Write a function that takes a byte, and prints it in binary value **without a newline at the end**.
### Expected function
```go
func PrintBits(octe byte) {
}
Write a program that takes a number as argument, and prints it in binary value **without a newline at the end**.
- If the the argument isn't a number it should print `00000000`.
### Expected output :
```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$
```
### Usage
Example of output:
If 2 is passed to the function `PrintBits`, it will print "00000010".

Loading…
Cancel
Save