Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

how to find avareage of an array in c#

public static float average(int[] numbers)
{
  int sum;
  foreach (int number in numbers)
  {
    sum += number;
  }
  return sum / numbers.Length;
  //note: their might be other simple ways 
}
 
PREVIOUS NEXT
Tagged: #find #avareage #array
ADD COMMENT
Topic
Name
3+4 =