# C# Programming Examples on Conversions

Here is the listing of C# programming examples on Conversions.

#### 1. C# Examples on Number System Conversions

A Binary System has two possible values 0 and 1, Decimal System has 10 possible values (0,1,2,3,4,5,6,7,8,9) and a Octal System has 8 possible values (0,1,2,3,4,5,6,7). The programs in the section perform Binary to Decimal conversion, Decimal to Binary conversion and Decimal to Octal conversion. It also converts temperature in the Celsius scale to the temperature in the Fahrenheit scale. A Gray code is the number encoding such that adjacent numbers have a single digit differing by 1. The program in the section creates a gray code, gets the character from the user and converts the case of the character.

#### 2. C# Examples Dealing with Hexadecimal and Decimal Notations

The digits used to represent numbers using hexadecimal notation are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. The following programs convert a hexadecimal number into a decimal number and vice versa. The programs also convert meter to kilometer and vice versa. The program also converts a given number of days in terms of years, weeks & days. The remaining program in the section performs various type conversions.

#### 3. C# Examples dealing with Prefix, Postfix, Big Endian and Little Endian Notation

Operators are written in-between their operands in Infix notation and Operators are written after their operands in Postfix notation. Big-endian is an order in which the most significant value is stored first. Little-endian is an order in which the least significant value is stored first. The programs in the following section converts an Infix expression to a Postfix expression, converts Big Endian format to Little Endian format. The remaining programs in the section converts digits to words and demonstrates DefaultIfEmpty case.

C# Program to Convert Digits to Words C# Program to Convert Infix to Postfix C# Program to Demonstrate DefaultIfEmpty case C# Program to Convert Big Endian to Little Endian |