#include #include //for setw #include using namespace std; //Sort the 2021 median household income for each state in decreasing order. int main() { int a[] { 53913, 77845, 69056, 52528, 84907, 82254, 83771, 71091, 63062, 66559, 84857, 66474, 72205, 62743, 65600, 64124, 55573, 52087, 64767, 90203, 89645, 63498, 77720, 48716, 61847, 63249, 66817, 66274, 88465, 89296, 53992, 74314, 61972, 66519, 62262, 55826, 71562, 68957, 74008, 59318, 66143, 59695, 66962, 79449, 72431, 80963, 84247, 51248, 67125, 65204 }; const size_t n {size(a)}; for (int i {n - 1}; i > 0; --i) { for (int j {0}; j < i; ++j) { // Reverse the comparison for decreasing order if (a[j] < a[j + 1]) { const int temp {a[j]}; a[j] = a[j + 1]; a[j + 1] = temp; } } } for (int i {0}; i < n; ++i) { cout << setw(2) << i+1 << " " << a[i] << "\n"; } return EXIT_SUCCESS; }