ข้ามไปยังเนื้อหา

บวก 1 ถึง 100

บวกเลข 1 ถึง 100

บวกเลขเต็มทุกตัวตั้งแต่ 1 ถึง 100 และพิมพ์ผลลัพธ์

This is a running total: start at 0 and add the loop variable on every pass. The starter adds 1 to 10, so you only need to change where the range stops. The young Carl Friedrich Gauss is said to have found this answer in his head by pairing 1 + 100, 2 + 99 and so on.

เข้าสู่ระบบหรือสร้างบัญชี

IGCSE, A-Level & AP