Program that returns the text form of each digit less than 5

Amatya
Posted by Amatya under C# category on | Points: 40 | Views : 172
LINQ program that returns the text form of each digit less than 5

public void DNF() 
{
int[] DNFnumbers = { 50, 5, 1, 4, 8, 12, 78, 51, 0, 2 };
string[] DNFdigits = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };

var DNFSmall =
from n in DNFnumbers
where n < 5
select DNFdigits[n];

Console.WriteLine("DNFNumbers < 5:");
foreach (var x in DNFSmall)
{
Console.WriteLine(x);
}
}


Thanks
Amatya

Comments or Responses

Login to post response