Skip to content · ⁨본문 바로가기⁩

How many halvings? · ⁨얼마나 반으로 나눴는가?⁩

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.

한국어

반으로 나누는 횟수?

n는 40에서 시작합니다. n = n // 2를 사용하여 반으로 나누고 0에 도달할 때까지 steps에 단계를 세합니다.

//는 나눈 후 나머지를 버리므로, 5 // 2은 2가 됩니다. 루프가 몇 번이나 도는지 세는 것은 별도의 변수가 필요하며, 매 순환마다 1씩 증가해야 합니다.

Log in or create account · ⁨로그인 또는 계정 만들기⁩

IGCSE, A-Level & AP