hi guys, i need to find the smallest non-zero value in each row and print them to the screen.
for instance this case will be
2, 15, 49, 11. I've been thinking bout this for quite long time, can anyone give me some hints here plss ?
Code:
int table [5][5] =
{
{10, 0, 2, 23, 0},
{0, 15, 0, 45, 35},
{0, 49, 89, 0, 59},
{0, 11, 0, 52, 22}
};
int row, col, smallest;
for (row = 0; row < 5; row++)
{
for (col = 0; col < 5; col++)
{
if (table[row][col] != 0)
smallest = table[row][col];
}
printf("%d, ", smallest);
}
// my incomplete code so far :D