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
How do you create empty strings in c#?
What is difference between property and variable in c#?
Does c# support a variable number of arguments?
Explain the concepts of cts and cls(common language specification).
What is the use of parse in c#?
Is vs as c#?
What are the advantages of constructor?
What is difference between class and interface in c#?
What are the main reasons to use c# language?
What are the types of methods in c#?
Explain how do you debug an asp.net web application?
What are the types in c#?
What is a hash table c#?
What are primitive data types in c#?
What is the difference between private and protected in c#?