|
|
@ -6,11 +6,11 @@ Write a program that determines if a given number is a power of 2. |
|
|
|
|
|
|
|
|
|
|
|
This program must print `true` if the given number is a power of 2, otherwise it prints `false`. |
|
|
|
This program must print `true` if the given number is a power of 2, otherwise it prints `false`. |
|
|
|
|
|
|
|
|
|
|
|
- If there's no arguments passed to the program or there's more that one it shohuld print `\n`. |
|
|
|
- If there is more than one or no argument the program should print a newline ("`\n`"). |
|
|
|
|
|
|
|
|
|
|
|
- In case of error you shoud handle it. |
|
|
|
- Error cases have to be handled. |
|
|
|
|
|
|
|
|
|
|
|
### Expected output : |
|
|
|
### Usage : |
|
|
|
|
|
|
|
|
|
|
|
```console |
|
|
|
```console |
|
|
|
student@ubuntu:~/ispowerof2$ go build |
|
|
|
student@ubuntu:~/ispowerof2$ go build |
|
|
@ -24,5 +24,7 @@ student@ubuntu:~/ispowerof2$ ./ispowerof2 |
|
|
|
|
|
|
|
|
|
|
|
student@ubuntu:~/ispowerof2$ ./ispowerof2 64 1024 |
|
|
|
student@ubuntu:~/ispowerof2$ ./ispowerof2 64 1024 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
student@ubuntu:~/ispowerof2$ ./ispowerof2 notanumber | cat -e |
|
|
|
|
|
|
|
strconv.Atoi: parsing "a": invalid syntax$ |
|
|
|
student@ubuntu:~/ispowerof2$ |
|
|
|
student@ubuntu:~/ispowerof2$ |
|
|
|
``` |
|
|
|
``` |