Skip to content

Double until it passes 100 · ⁨翻倍直到超过 100⁩

English

Double until it passes 100

n starts at 1. Keep doubling it while it is 100 or less. Store the first value over 100 in n.

Here the value being tested is the value being changed, so the loop needs no separate counter. It stops the moment the question turns false — and n keeps the value that made it false.

中文

翻倍直到超过 100

n 从 1 开始。只要它小于或等于 100 就不断翻倍。把第一个超过 100 的值留在 n 里。

这里被判断的值就是被改变的值,所以循环不需要另外的计数器。问题一变成“否”它就停下 —— n 里留着的就是让它变“否”的那个值。

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩