© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2021
R. VystavělC# Programming for Absolute Beginnershttps://doi.org/10.1007/978-1-4842-7147-6_24

24. Accumulating Intermediate Results

Radek Vystavěl1  
(1)
Ondřejov, 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 zero. In other words, users indicate they are finished by entering zero. ...

Get C# Programming for Absolute Beginners: Learn to Think Like a Programmer and Start Writing Code now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.