Loops are great for accumulating values! Your task: Read an integer N and calculate the sum of all numbers from 1 to N. Print the result.
C++20 sections · 1024 units
Open in CourseChallenge: Sum of Numbers
Loop with accumulator
Loop with accumulator
Loops are great for accumulating values! Your task: Read an integer N and calculate the sum of all numbers from 1 to N. Print the result.