mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-04 22:28:40 +08:00
Sync the while loop in iteration.cs with other languages (#746)
This commit is contained in:
@ -36,9 +36,9 @@ public class iteration {
|
|||||||
// 循环求和 1, 2, 4, 5...
|
// 循环求和 1, 2, 4, 5...
|
||||||
while (i <= n) {
|
while (i <= n) {
|
||||||
res += i;
|
res += i;
|
||||||
i += 1; // 更新条件变量
|
// 更新条件变量
|
||||||
res += i;
|
i += 1;
|
||||||
i *= 2; // 更新条件变量
|
i *= 2;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user