using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int num, unit, ten;
Console.Write("\t\t\t** Developed by : GE ** \n\n ");
Console.Write("Enter number here in range 0-50 : ");
num = Convert.ToInt16(Console.ReadLine());
unit = num % 10;
ten = num / 10;
Console.Write("You entered : ");
if (num > 50)
{
Console.WriteLine("Error (Number out of Range) ");
}
else if (num >= 10 && num <= 19)
{
switch (num)
{
case 10:
Console.WriteLine("Ten = " + num);
break;
case 11:
Console.WriteLine("Eleven = " + num);
break;
case 12:
Console.WriteLine("Twelve = " + num);
break;
case 13:
Console.WriteLine("Thirteen = " + num);
break;
case 14:
Console.WriteLine("Fourteen = " + num);
break;
case 15:
Console.WriteLine("Fifteen = " + num);
break;
case 16:
Console.WriteLine("Sixteen = " + num);
break;
case 17:
Console.WriteLine("Seventeen = " + num);
break;
case 18:
Console.WriteLine("Eighteen = " + num);
break;
case 19:
Console.WriteLine("Nineteen = " + num);
break;
}
}
else if (num >= 20 && num <= 50)
{
switch (ten)
{
case 2:
Console.Write("Twenty");
break;
case 3:
Console.Write("Thirty");
break;
case 4:
Console.Write("Fourty");
break;
case 5:
Console.Write("Fifty");
break;
}
switch (unit)
{
case 0:
Console.WriteLine(" ");
break;
case 1:
Console.WriteLine("one");
break;
case 2:
Console.WriteLine("two");
break;
case 3:
Console.WriteLine("three");
break;
case 4:
Console.WriteLine("four");
break;
case 5:
Console.WriteLine("five");
break;
case 6:
Console.WriteLine("six");
break;
case 7:
Console.WriteLine("seven");
break;
case 8:
Console.WriteLine("eight");
break;
case 9:
Console.WriteLine("nine");
break;
}
}
else if (num >= 0 && num <= 9)
{
switch (num)
{
case 0:
Console.WriteLine("zero");
break;
case 1:
Console.WriteLine("one");
break;
case 2:
Console.WriteLine("two");
break;
case 3:
Console.WriteLine("three");
break;
case 4:
Console.WriteLine("four");
break;
case 5:
Console.WriteLine("five");
break;
case 6:
Console.WriteLine("six");
break;
case 7:
Console.WriteLine("seven");
break;
case 8:
Console.WriteLine("eight");
break;
case 9:
Console.WriteLine("nine");
break;
}
}
Console.ReadLine();
}
}
}
fashxfreak 3 Newbie Poster
thines01 401 Postaholic Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.