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
Project Description: I require a custom texture painting plug-in for the latest version of Unity 3D. The project can have features that are common in Photoshop and Mari for pain


How do we configure "WebGarden"? The process model configured the "Web garden" settings in the "machine.config" or in the "Web.config" file. The configuration section is named

Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Textilepro.frmLogin.resources" was correctly embedded or linked into assembly


How can we connect to Microsoft Access, Foxpro , Oracle etc ? The Microsoft provides System.Data.OleDb namespace to communicate with the databases such as Oracle, scess  etc. I

I am looking for learning management software (LMS) preferably in ASP.NET and Microsoft SQL/ MYSQL server as the database. The broad scope of the system could be 1. User managem

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

Required: An implementation of a two player game. Keep the game simple ROCK PAPER SCOSSORS A two player game, each player on a different browser instance.  (pro

Develop Skype Recorder Application + Setup + Sourcecode + NICE UI Project Description: i need an application built which will allow user to record skype audio or video calls