diff --git a/subjects/ispowerof2.en.md b/subjects/ispowerof2.en.md index 0a3fabb95..b9d8ead24 100644 --- a/subjects/ispowerof2.en.md +++ b/subjects/ispowerof2.en.md @@ -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`. -- 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 student@ubuntu:~/ispowerof2$ go build @@ -24,5 +24,7 @@ student@ubuntu:~/ispowerof2$ ./ispowerof2 student@ubuntu:~/ispowerof2$ ./ispowerof2 64 1024 +student@ubuntu:~/ispowerof2$ ./ispowerof2 notanumber | cat -e +strconv.Atoi: parsing "a": invalid syntax$ student@ubuntu:~/ispowerof2$ -``` \ No newline at end of file +``` diff --git a/subjects/ispowerof2.fr.md b/subjects/ispowerof2.fr.md index 8147db777..25e5f3171 100644 --- a/subjects/ispowerof2.fr.md +++ b/subjects/ispowerof2.fr.md @@ -2,14 +2,29 @@ ### Instructions -Écrire une fonction qui détermine si un nombre donné est une puissance de 2. +Écrire un programme fonction qui détermine si un nombre donné est une puissance de 2. -Cette fonction retourne `true` si le nombre donné est une puissance de 2, autrement elle retourne `false`. +Ce programme doit afficher `true` si le nombre donné est une puissance de 2, autrement il affiche `false`. -### Fonction attendue +- Si il y a plus d'un ou aucun argument le programme doit afficher un newline ("`\n`"). -```go -func IsPowerOf2(n uint) bool { +- Les cas d'erreurs doivent être gérés. -} +### Utilisation : + +```console +student@ubuntu:~/ispowerof2$ go build +student@ubuntu:~/ispowerof2$ ./ispowerof2 2 | cat -e +true$ +student@ubuntu:~/ispowerof2$ ./ispowerof2 64 | cat -e +true$ +student@ubuntu:~/ispowerof2$ ./ispowerof2 513 | cat -e +false$ +student@ubuntu:~/ispowerof2$ ./ispowerof2 + +student@ubuntu:~/ispowerof2$ ./ispowerof2 64 1024 + +student@ubuntu:~/ispowerof2$ ./ispowerof2 notanumber | cat -e +strconv.Atoi: parsing "a": invalid syntax$ +student@ubuntu:~/ispowerof2$ ```