Write a function that will accept an array of integers and the length of the array, find the two largest even integers in the array, multiply them together, and return the result.

Nov 3 2008 11:51 PM

public int FindlargestNumber(int[] iarray)
        {
            int maxvalue = 0;
            for (int i = 0; i <= iarray.Length - 1; i++)
            {
                if (iarray[i] > maxvalue)
                {
                    maxvalue = iarray[i];
                   
                }
                if (maxvalue % 2 == 0)
                {
 
                }
            }
            return maxvalue;
     
        }

 

This will return only one max value how would I  implement the same to get top n values??

Regards

Sangeetha


Answers (2)