Finding largest array element - c# program, DOT NET Programming

Finding Largest Array Element - C# Program

I am unable to make out the Largest Array Element in C# language. Can anyone suggest me any example for this.

Posted Date: 2/12/2013 1:03:20 AM | Location : United States





This program will help you, try it out

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();       

 }  

  // Determining the largest array element   static int Large (params int [] arr)

 {

   int temp=0;  

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

  {

    if (temp <= arr[i])

   {

    temp = arr[i];

   }

  }

   return(temp);

 }

}

Posted by Aana | Posted Date: 2/12/2013 1:05:57 AM

As a C# beginner, this is the first time out of at least three previous tried ?that, I can finally understand how can i Find largest array element. Thank You so much.

Posted by Alice | Posted Date: 2/12/2013 1:07:39 AM


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

Write discussion on Finding largest array element - c# program
Your posts are moderated
Related Questions
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

What is cross page posting? By default, the button controls in the ASP.NET pages post back to the similar page that contains button, where you can write an event handler for th

I need Ninjatrader Strategy Project Description: UI for managing orders, entering trades. This project will probably take several months and I need dedicated resources. Sk

What is the main difference between sub-procedure and function? The sub-procedure is a block of multiple visual basic statements within Sub and End Sub statements. It is used t

We have a web based program completed with .NET C# and Microsoft SQL Server. There are some reports requires to be created. Required Skills. - High Proficiency in .NET C#

Project Description: I require a C# Console project written to simply enter an Origin and Destination/Date on the United Airlines Site, from the returned page select and return

Explain MVC and how it is diffrennt from Asp.net

What is the DTD? The DTD is Document Type Definition that explains the formation of the content of an XML document. The DTD manages the data to keep in a consistent format. It

Have you ever worked with Microsoft Application Blocks, if yes then which? The Application Blocks are C# & the VB.NET classes distributed as the Visual Studio projects which ca

How do I write common code for different dot net framework data providers?