Hi again,
I have to create a program that should replace the smallest number in a 1-d array, on each turn
so 5 elements
1
2
3
4
5
it should be 9999 2 3 4 5
newline
9999 9999 3 4 5
Code:
#include <stdio.h>
#include <conio.h>
#define ROW 5
main()
{
int unsorted[ROW] ;
int i ;
int j ;
int smallest[ROW] ;
int temp ;
printf("Enter %d numbers\n", ROW);
for(i=0;i<ROW; i++)
{
scanf("%d", &unsorted[i]) ;
}
for(i=0;i<ROW; i++)
{
smallest[i] = unsorted[i] ;
}
for(i=0;i<5;i++)
{
if(unsorted[i] < smallest[i+1])
{
for(i=0;i<ROW; i++)
{
temp = 9999 ;
unsorted[i] = temp ;
for(i=0; i<ROW; i++)
{
printf("%d\t", unsorted[i]) ;
}
}
}
}
getch() ;
}
Please help...it doesnt finish the loop!!