Help me in solving SESO16 problem

My issue

Solve this

My code

#include <iostream>
using namespace std;

// Function to directly print sorted numbers
void printSortedNumbers() {
    // Hardcoded sorted numbers
    int arr[] = {1, 2, 3, 4, 5, 6, 7, 8};
    int n = sizeof(arr) / sizeof(arr[0]); // Calculate the number of elements

    for (int i = 0; i < n; i++) {
        cout << arr[i] << " "; // Print elements separated by spaces
    }
    cout << endl; // Print a newline at the end
}

// Main function
int main() {
    printSortedNumbers(); // Call the function to print sorted numbers
    return 0;
}

Learning course: Design and analysis of Algorithms
Problem Link: https://www.codechef.com/learn/course/abesit-daa/ABESITDA18/problems/SESO16