Skip to content · ⁨Passer au contenu⁩

How many halvings? · ⁨Combien de demi-réductions ?⁩

English

How many halvings?

n starts at 40. Halve it with n = n // 2 until it reaches 0, counting the steps in steps.

// divides and throws the remainder away, so 5 // 2 is 2. Counting how many times a loop went round needs its own variable, going up by one each turn.

Français

Combien de demi-parties ?

n commence à 40. Divisez-le par deux avec n = n // 2 jusqu'à ce qu'il atteigne 0, en comptant les étapes dans steps.

// divise et jette le reste, donc 5 // 2 est 2. Compter combien de fois une boucle a tourné a besoin de sa propre variable, augmentant d'une à chaque tour.

Log in or create account · ⁨Se connecter ou créer un compte⁩

IGCSE, A-Level & AP