85. Sort an Array in Ascending Order

You are given an array of n unsigned 8-bit integers (uint8_t). Your task is to:

  • Sort the array in ascending order
  • Print the sorted array as space-separated values 

Do not use any standard library sort functions.

Use only loop and comparison logic (firmware-safe implementation).


Example-1

Input: n = 5, arr = [10 3 5 2 7]
Output: 2 3 5 7 10


Example-2

Input: n = 3, arr = [255 0 128]
Output: 0 128 255


Example-3

Input: n = 1, arr = [42]
Output: 42


 

Loading...

Input

5 10 3 5 2 7

Expected Output

2 3 5 7 10