© Radek Vystavěl 2017

Radek Vystavěl, C# Programming for Absolute Beginners, https://doi.org/10.1007/978-1-4842-3318-4_24

24. Accumulating Intermediate Results

Radek Vystavěl

(1)Ondřjov, Czech Republic

In this chapter, you will study the important case of using loops to process large sets of data. You will often use a loop to go through a large amount of data to accumulate (aggregate) some intermediate result, which becomes the final result after the loop terminates.

Sum of the Entered Numbers

A typical task in this category is summing a lot of values.

Task

Say the user is entering numbers, with the last one being 0. In other words, users indicate they are finished by entering 0. The program then displays the sum of all the entered numbers (see ...

Get C# Programming for Absolute Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.