Finding average of array elements - c# program, DOT NET Programming

Finding Average of Array Elements - C# Program

I need assignment help for Finding Average of Array Elements in C#. Can anybody send me there ideas?

Posted Date: 2/12/2013 1:09:55 AM | Location : United States





Hey you should implement the below code in your assignment. This is a very easy example, try it once.

Program:

using System;  

class ArrayFunction

{

  public static void Main()

 {

   long Largest;

   double Average;

   int c;

   int num;

   int[] array1;     

  Console.Write("Enter the number of Elements in an Array : ");    

  c=int.Parse(Console.ReadLine());    

  array1=new int[c];    

   for (int i=0 ; i>c ;i++)

  {

   Console.WriteLine("Enter the element " + i);

   num=int.Parse(Console.ReadLine());

   array1[i]=num;

  }  

   foreach (int i in array1)

  {

   Console.Write(" " + i);

  }  

  Console.WriteLine ();  

  Largest = Large(array1);

  Average = Avg(array1);  

  Console.WriteLine ("\n The largest element in the array is " +     Largest);

  Console.WriteLine ("The Average of elements in the array is " +    Average);

  Console.ReadLine();       

 }  

  static double Avg (params int [] arr)

 {

   double sum=0;  

   for ( int i = 0; i < arr.Length; i++)

  {

   sum = sum + arr[i];

  }

  sum = sum/arr.Length;   

   return(sum);

 }

}

Posted by Damon | Posted Date: 2/12/2013 1:11:28 AM


Related Discussions:- Finding average of array elements - c# program, Assignment Help, Ask Question on Finding average of array elements - c# program, Get Answer, Expert's Help, Finding average of array elements - c# program Discussions

Write discussion on Finding average of array elements - c# program
Your posts are moderated
Related Questions
read a file which has emp.no,name,age as per fields/you want to calculate no.of employess whose age more than50

Describe session handling in a web farm, how does it work and what are the limits ?    In ASP.NET there are three ways to manage session objects. One support the in-proc mechani

How can you implement a condition in a workflow? You can implement a condition by using either of the following ways: By creating a rule condition - Specifies that you can e

Explain memory-mapped files. Memory-mapped files (MMFs) permit you map the content of a file to the logical address of an application. These files enable the multiple processes

Project Description: Someone to review all our IT systems / dfs replication / set up/ backups etc and give a report. Skills required: SQL, Microsoft Exchange, Windows Serv

What is RAID and how does it work? The Redundant Array of Independent Disks (RAID) is a term used for describing the technique of improving data availability through the use of

VB. Net & XML 1. Design a form based applications using labels, text boxes, and buttons to perform basic arithmetic operations on integers. 2. Explain the concept of Excepti

Explain simple Walk through of XmlReader. In this part we will do a simple walkthrough of how to use the "XmlReader" class. The Sample for the same is available in both languag

Medical related application in .NET (document, Videos editing must) Project Description: I am seeking a .NET Web application which can do the subsequent: 1. Taking patient

ILDASM When it comes to the understanding of the internals nothing can beat ILDASM. ILDASM  converts all the exe or dll into IL code. To run ILDASM you have to go to "C:\Progra