Sync the while loop in iteration.cs with other languages (#746)

This commit is contained in:
malone6 2023-09-13 03:06:40 +08:00 committed by GitHub
parent d5bac12f60
commit 9b8625d741
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,9 +36,9 @@ public class iteration {
// 循环求和 1, 2, 4, 5...
while (i <= n) {
res += i;
i += 1; // 更新条件变量
res += i;
i *= 2; // 更新条件变量
// 更新条件变量
i += 1;
i *= 2;
}
return res;
}