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
I want simple code for Outlook (express,2003,2007,2010,2013) Add-In with functionality to routinely send CC to the specified email(s), this system should have -Code for every th

Differentiate between the while and for loop in C#. The while and for loops are used to implement those units of code that require to be repeatedly executed, unless the result

Hi, I have been working on Dot Net over the past few years. I would like to do online tutoring for .NET. Could you please let me know the possible oppurtunities

Project Description: The website should be CMS based; coding done only on ASP, MySql databases, .net script, aspx and java use with least of the flash work. We will be sharing j

GAC (Global Assembly Cache) is used where shared .NET assembly resides.Global Assembly Cache is used in the following situations:- 1) When the application has to be shared among

Auto stock market robot Project Description: A total solution for the Robot trading on Nse , currency, Mcx, ncdex,using formulas or using buy sell signals . The solution s

Project Description: I have a website that I have prepared, but I would like someone to make it look nicer. Most of the functionality is there, but I need help with design which

Question: (a) Explain the function of the main .NET data objects: Connection, Command, DataReader, DataAdapter, DataSet, DataTableCollection, and DataView. (b) Describe h

Define XPATH. XPATH is an XML query language to select specific section of an XML document. By using XPATH you can address or filter elements and text in a XML document. For il

Explain the concept of Web services in brief. A Web service may be explained as an independent and self-sustained unit of a software application that is hosted on the Web and i