From 9b8625d7417b8229ed3aa09df6563b3310e09669 Mon Sep 17 00:00:00 2001 From: malone6 Date: Wed, 13 Sep 2023 03:06:40 +0800 Subject: [PATCH] Sync the while loop in iteration.cs with other languages (#746) --- codes/csharp/chapter_computational_complexity/iteration.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codes/csharp/chapter_computational_complexity/iteration.cs b/codes/csharp/chapter_computational_complexity/iteration.cs index e4b851ae..31fde69f 100644 --- a/codes/csharp/chapter_computational_complexity/iteration.cs +++ b/codes/csharp/chapter_computational_complexity/iteration.cs @@ -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; }