Compute the average of a set of values 2 : Array : Collections Data Structure C# Source Code


Custom Search

C# Source Code » Collections Data Structure » Array »

 

Compute the average of a set of values 2









    

// Compute the average of a set of values. 
 
using System; 
 
public class Average {  
  public static void Main() {  
    int[] nums = { 99, 10, 100, 18, 78, 23, 63, 9, 87, 49 }; 
    int avg = 0;; 
 
    for(int i=0; i < 10; i++)  {
      avg = avg + nums[i]; 
    }  
 
    avg = avg / 10; 
 
    Console.WriteLine("Average: " + avg); 
  }  
} 

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Collections Data Structure
» Array