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

how to get the oracle certification? send me the answer

0 Answers   Oracle,


What is difference between inheritance and polymorphism?

0 Answers  


What is Hashing and how is it done? Pictorial form?

2 Answers   emc2, Wipro,


can inline function declare in private part of class?

1 Answers  


What is the importance of oop?

0 Answers  






Do you know about multiple inheritance?

0 Answers   Motorola,


What is a linked list?

7 Answers   IBM, Neural Info,


write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory

0 Answers  


What is the important feature of inheritance?

0 Answers   BPL,


how to swap to variables without using thrid variable in java?

5 Answers  


Why do we use encapsulation in oops?

0 Answers  


1.explicit call for destructor 2.calling function inside a constructor. 3.base *b-new derived delete b; 4.delete p what it will delete. 5.size of base class and derived class int i,in base class and int j in derived. 6.int i-20 int main() { int i =5; printf("%d".::i); { int i =10; printf("%d".::i); } } 7.object slicing 8.new 9.function overloading(return type). 10.class base() { virtuval fun() { ----- } } class derivied:public base() { fun() { ----- } } int main() { derived d; } 11.how static function will call in C++? 12.default structures are in C++? 13.constructors should be in public . 14.virtuval constructor not exist. 15.multilevel inhritence. destructor order.

1 Answers   Tech Mahindra,


Categories