I have to write a program that that reads an array of integer numbers, stores them in array, sort the numbers in ascending order, and print the sorted array: using the buble sort technique.
Unfortunately I can't seem to get it to work at all, and I know <stdio.h> is probably not efficient but thats what we're supposed to use. This is my first programming class, and any help would be greatly appreciated.
I'm sorry its so horribly written:
#include <stdio.h>
#define N 5
int main ()
{
int array[N], temp, i, j;
printf("please enter 5 numbers to be sorted\n");
scanf("%i \n", &array[i]);
for(i=0; i<N; i++ )
{for(j=0; j < N-1; j++){
if (array[j] > array[j+1])
{temp=array[j];
array[j]=array[j+1];
array[j+1]=temp;
}
}
printf("%i\n", array[i]);
}
return 0;
}