Practical : 9
Subject : .NET
Code:
using System;
class Program
{
static void Main(string[] args)
{
String []words={"Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine"};
Console.WriteLine("Enter the number:");
int n = int.Parse(Console.ReadLine());
int []d=new int[10];
int i=0;
int count = 0;
while (n > 0)
{
int temp = n % 10;
d[i] = temp;
n = n / 10;
count++;
i++;
}
for (i = count; i > 0; i--)
{
Console.Write(words[d[i-1]]+" ");
}
Console.ReadKey();
}
}
class Program
{
static void Main(string[] args)
{
String []words={"Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine"};
Console.WriteLine("Enter the number:");
int n = int.Parse(Console.ReadLine());
int []d=new int[10];
int i=0;
int count = 0;
while (n > 0)
{
int temp = n % 10;
d[i] = temp;
n = n / 10;
count++;
i++;
}
for (i = count; i > 0; i--)
{
Console.Write(words[d[i-1]]+" ");
}
Console.ReadKey();
}
}
Output:
Sign up here with your email
ConversionConversion EmoticonEmoticon