Finding of the 4 larger (bigger) numbers from the list
like{1245,4587,2145,1163,29987,65783.....}



Finding of the 4 larger (bigger) numbers from the list like{1245,4587,2145,1163,29987,65783.....}..

Answer / santhosh

int Max = 4;
List<int> lst = new List<int>(new int[] { 1, 12,
2, 11, 15, 3, 14, 4, 5, 6, 7, 8, 9, 10 });
lst.Sort();
if (Max <= lst.Count)
Console.WriteLine(string.Format("The {0} th
Maximum value is {1}.", Max, lst[lst.Count - Max]));
else
Console.WriteLine(string.Format("This list
contain less items. So you could not find the {0}th highest
value from the list.", Max));

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More OOPS Interview Questions

You attempt to query the data base with this command: SELECT name, salary FROM employee WHERE salary=(SELECT salary FROM employee WHERE last name='Wagner' OR dept no=233) Choose most appropriate option from the following: 1)Sub-queries are not allowed in the where clause. 2)a multiple row sub-query used with a single row comparison operator. 3)a single row query is used with a multiple row comparison operator.

10 Answers   Zycus Infotech,


What is for loop and its syntax?

0 Answers  


Difference between vector and array

2 Answers  


What type of Job you are providing?

0 Answers  


When is an object created and what is its lifetime?

4 Answers   IBM,






how to get the oracle certification? send me the answer

0 Answers   Oracle,


What are the components of marker interface?

0 Answers  


How compiler selects(internally) required overridden function in inheritance?

2 Answers   CSC, Infinite Computer Solutions,


if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?

1 Answers  


What is the significance of classes in oop?

0 Answers  


why constructor cannt be declar virtually? why destructor cannt be overloaded?

2 Answers   Infosys,


what is difference between String s=new String("vali"); String s="vali"

1 Answers  


Categories