Search⌘ K
AI Features

Converting Numbers from Cardinal to Ordinal

Explore how to create a C# function that converts cardinal numbers into their ordinal forms, such as 1 to 1st and 2 to 2nd. Learn to handle special cases with switch expressions and implement a loop to display results up to 1500. This lesson enhances your skills in writing, debugging, and testing useful functions.

Exploring the numbers, we encounter cardinal numbers and ordinal numbers. The distinction between these two types plays a significant role in various contexts. In the upcoming steps, we'll explore creating a versatile function that converts cardinal numbers to their corresponding ordinal counterparts.

Cardinal and ordinal numbers

Numbers used to count are called cardinal numbers. For example, 11, 22, and 33, whereas numbers used to order are ordinal numbers, for example, 1st1st ...