Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

how to find min of an array in c#

public static int min(int[] numbers)
{
  int min;
  bool first_time = true;

  foreach (int number in numbers)
  {
    if(first_time)
    {
      min = number
    }
    else
    {
      if (number < min)
      {
        min = number;
      }
    }
  }
  return min;
  //note: there might be other simple ways
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #find #min #array
ADD COMMENT
Topic
Name
7+9 =