How can you sort the elements of the array in descending
order?
Answer Posted / anubhav gupta
int[] arr = new int[4];
arr[0] = 22;
arr[1] = 33;
arr[2] = 11;
arr[3] = 44;
Array.Sort(arr);//First sort the array in accending
order
Array.Reverse(arr);//then do reverse of array for
descending order
foreach (int a in arr)
{
Response.Write(a+"--");
}
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What are bitwise logical operators?
What do you mean by hashtable c#?
What is the difference between User controls and Custom Controls?
if you do have a stack overflow profile.what is your ranking?
What is session variable in c#?
If I want to override a method one of class A and in class b then how do you declare?
If a method's return type is void, can you use a return keyword in the method?
How do I simulate optional parameters to com calls?
Is string primitive?
How to declares a two-dimensional array in C#?
What is data hiding in c#?
Is namespace a class?
What is the implicit name of the parameter that gets passed into the set method/property of a class?
What debugging tools come with the .NET ssSDK?
Will the following code compile?