Hi everybody. I decided to make an account here because I could use some help writing some code. This is what I need to do:
Write a C program that will read in two lines of data. The first data line contains an integer N and the second data line contains N different positive integers. The program should arrange these integers so that every number that is less than or equal to N occurs in its proper numeric place and all other numbers are in increasing order. You may assume that N <= 20. The data should be read into your program via calls to the fscanf function. The name of the data is located on the command line as argv.
Example: If the input is
2 7 8 1 20 9 5
The output would be: 1 2 8 9 5 20 7
Now, I know that I could sort the numbers into increasing order using a bubble sort, and I know that I could sort them all in numeric order by reading them into an array and then printing them from within a for loop, but I am confused as to how to do both at the same time.
Edited by brendono978: n/a