© 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_22

22. Number Series

Radek Vystavěl1  
(1)
Ondřejov, Czech Republic
 

Several programming tasks reduce to generating regular number series. This is what you are going to study in this chapter. You will also get a better understanding of loops this way.

Every Other

You are already able to generate a simple number series, say from one to ten. You will tackle generating a bit more complex series now.

Task

In this task, you will display “every other” number until 20 (see Figure 22-1).
Figure 22-1

Displaying every other number

Solution

Here’s the code:
static void Main(string[] args) ...

Get C# Programming for Absolute Beginners: Learn to Think Like a Programmer and Start Writing Code 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.