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.
 
 
 
 

763 B

ispowerof2

Instructions

Écrire un programme qui détermine si un nombre donné est une puissance de 2.

Ce programme doit afficher true si le nombre donné est une puissance de 2, autrement il affiche false.

  • Si il y a plus d'un ou aucun argument le programme doit afficher un retour à la ligne ('\n').

  • WSi il n'y a qu'un seul argument, ce sera toujours un int positif.

Usage :

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$