C# program to take a number between 0 to 9 and print the word representation for that number


Following program shows you how to take a number between 0 to 9 and print the word representation for that number.
In this program we get numbers between 0 to 9 from user and print word representation using if condition

using System;

class MainClass {
  public static void Main (string[] args) {
    Console.WriteLine("Enter a number between 0 to 9:");
    int input = Convert.ToInt32 (Console.ReadLine());
    if (input == 0) {
      Console.WriteLine("One");
      } else if (input == 2) {
        Console.WriteLine("Two");
      } else if (input == 3) {
          Console.WriteLine("Three");
      } else if (input == 4) {
            Console.WriteLine("Four");
      } else if (input == 5) {
              Console.WriteLine("Five");
      } else if (input == 6) {
                Console.WriteLine("Six");
      } else if (input == 7) {
                Console.WriteLine("Seven");
      } else if (input == 8) {
                  Console.WriteLine("Eight");
      } else if (input == 9) {
                    Console.WriteLine("Nine");
      } else {
                       Console.WriteLine("We don't have word representation for that number");
             }
  }
}

Output:

Example1:

Enter a number between 0 to 9:
 1
One

Example2:

Enter a number between 0 to 9:
 12
We don't have word representation for that number