I've looked up the algorithms and what I have should work if im reading it right but i am getting some weird numbers in my output and it is not always be sorted.
Example of error:
Enter the number of naturals: 4
Enter the natural numbers to sort: 45 2 43 7
Numbers sorted in ascending order:
32767 2 45 7 (error here, it doesn't sort and gives a weird number)
Enter the number to search: 2
Number 2 is found in position 1
Wow i cant believe ive been trying that for like 3 hours. It works but it adds an extra 0 at the beggining which replaces the biggest number. Any idea how to solve that?