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
Unity 4 iOS Pro Developer to prepare link.xml Project Description: I'm seeking an iOS developer with a Unity 4 iOS Pro license to prepare a link.xml file that will let my pro

Counting Number of Words in a String - C# Program Anyone can suggest me the output of the following program. using System;   class CountWords { public static void

what is the code for calculator in windowsapplication

Explain the WSDL. WSDL is a short form for Web Services Description Language, which is used to explain a Web service in terms of the messages that it forms and accepts. The WS

Web-App Developer for Startup Project Description: I am seeking someone who is good at building dynamic sites that will run on both desktops and tablets. The core of the w

What is the purpose of DOTNET? Dot Net Is a collection of products like C#, ASp.Net, Vb.Net, XML. The purpose of .Net is that we can simply upgrade and degrade our programs whi

Different types of remote object creation mode in .NET There are 2 different ways in which the object can be created using Remoting :- 1)SAO (Server Activated Objects) also

What is a class? A class describes all the attributes of objects, as well as the methods that execute the behaviour of member objects. It is a comprehensive data type, which sh

Prevent .NET DLL to be decompiled By design phase .NET embeds rich Metadata inside the executable code using the MSIL. Anyone can easily  decompile DLL back using tools such as

How can we perform transactions in .NET? The common sequence of steps that would be performed for developing a transactional application is as follows: 1)In the first step o