Help me in solving LPYAS168 problem

My issue

answer in c language

My code

n = int(input())
arr = list(map(int, input().split()))
n = len(arr)
for i in range(n):
    for j in range(0, n-i-1):
        # Traverse the array from 0 to n-i-1
        # Swap if the element found is greater than the next element
        if arr[j] > arr[j+1]:
            arr[j], arr[j+1] = arr[j+1], arr[j]

print(*arr)

Learning course: Algorithmic Problem Solving
Problem Link: https://www.codechef.com/learn/course/klu-problem-solving/KLUPS00A/problems/LPYAS168