# The long lost longest number

The long lost longest number programming exercise.

How hard is it to search… without a rest… for hours, for days, for years… for eons! But the search will end soon! For the programmers of the planet Earth can help!

Write a function that takers and array of numbers and finds and returns the number with most digits.

If two, or more, numbers in the array have the same number of digits, return the first one.

```Example:
{1,22,515,3,87,1290,0,-4} => 1290
{0,3,55,99} => 55```

Scroll down to see the solution of this coding problem.

```   public static int FindLongest(int[] number)
{
//first lets declare some variables
//one for the result
//and one for the length of the largest number
int r = 0;
string maxLen = "";
//then lets find the length of the largest number
foreach (var item in number)
{
string len = item.ToString();
if (len.Length>maxLen.Length) maxLen = len;
}
//and then well will check the numbers
//and return as the result the first one with that
//length
foreach (var item in number)
{
string len = item.ToString();
if (len.Length == maxLen.Length) return item;
}
return r;
}```