Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int a = int.Parse(Console.ReadLine());
- int a1 = 0;
- int a2 = 0;
- if(a>=0 && a<=19)
- {
- if(a==0)
- Console.WriteLine("zero");
- else if(a==1)
- Console.WriteLine("one");
- else if (a == 2)
- Console.WriteLine("two");
- else if (a == 3)
- Console.WriteLine("three");
- else if (a == 4)
- Console.WriteLine("four");
- else if (a == 5)
- Console.WriteLine("five");
- else if (a == 6)
- Console.WriteLine("six");
- else if (a == 7)
- Console.WriteLine("seven");
- else if (a == 8)
- Console.WriteLine("eight");
- else if (a == 9)
- Console.WriteLine("nine");
- else if (a == 10)
- Console.WriteLine("ten");
- else if (a == 11)
- Console.WriteLine("eleven");
- else if (a == 12)
- Console.WriteLine("twelve");
- else if (a == 13)
- Console.WriteLine("thirteen");
- else if (a == 14)
- Console.WriteLine("fourteen");
- else if (a == 15)
- Console.WriteLine("fifteen");
- else if (a == 16)
- Console.WriteLine("sixteen");
- else if (a == 17)
- Console.WriteLine("seventeen");
- else if (a == 18)
- Console.WriteLine("eighteen");
- else if (a == 19)
- Console.WriteLine("nineteen");
- }
- else if (a>=10 && a<=99)
- {
- a1 = a / 10;
- a2 = a % 10;
- if(a1==2)
- Console.Write("twenty");
- else if (a1 == 3)
- Console.Write("thirty");
- else if (a1 == 4)
- Console.Write("forty");
- else if (a1 == 5)
- Console.Write("fifty");
- else if (a1 == 6)
- Console.Write("sixty");
- else if (a1 == 7)
- Console.Write("seventy");
- else if (a1 == 8)
- Console.Write("eighty");
- else if (a1 == 9)
- Console.Write("ninety");
- if (a2 == 1)
- Console.WriteLine(" one");
- else if (a2 == 2)
- Console.WriteLine(" two");
- else if (a2 == 3)
- Console.WriteLine(" three");
- else if (a2 == 4)
- Console.WriteLine(" four");
- else if (a2 == 5)
- Console.WriteLine(" five");
- else if (a2 == 6)
- Console.WriteLine(" six");
- else if (a2 == 7)
- Console.WriteLine(" seven");
- else if (a2 == 8)
- Console.WriteLine(" eight");
- else if (a2 == 9)
- Console.WriteLine(" nine");
- }
- else if(a==100)
- Console.WriteLine("one hundred");
- else
- Console.WriteLine("invalid number");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement