Finding of the 4 larger (bigger) numbers from the list
like{1245,4587,2145,1163,29987,65783.....}
Answer Posted / 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 View All Answers
Why do while loop is used?
Is abstract thinking intelligence?
Advantage and disadvantage of routing in telecom sector
What is encapsulation example?
What is oops in simple words?
write a program to find 2 power of a 5digit number with out using big int and exponent ?
What is overriding in oop?
What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }
What is polymorphism and types?
Which is not an object oriented programming language?
write knight tour problem which is present in datastructure
How to hide the base class functionality in Inheritance?
#include
INSTANCE FIELDS DECLARED private ARE ACCESSIBLE BY THE METHODS ONLY.CAN WE CHANGE THE private FIELD OF AN OBJECT IN A METHOD OF SOME OTHER OBJECT OF THE SAME CLASS?
What are the benefits of interface?