Last Updated : 10 Apr, 2024
int arr[] = {2, 10, 5, 3, 4, 9, 8};
    sort(arr + 3, arr + sizeof(arr)/sizeof(arr[0]), greater<int>());
    
    for(int i = 0; i < sizeof(arr)/sizeof(arr[0]); i++)
       cout << arr[i] << \" \"; 

Output of the above program
(A) 2 10 9 8 5 4 3
(B) 2 10 5 9 8 4 3
(C) 2 10 5 3 9 8 4
(D) None of the mentioned


Answer: (B)

Explanation:
greater(): is the function that arranges the elements in decreasing order.


Share your thoughts in the comments