If I understand, based on your
so close post, the problem you are trying to solve is that the user enters a series of integers; they can keep entering integers until they either:
1) have entered 30 integers
2) they enter '0' to indicate they are done entering integers
As soon as one of these conditions is met, the program determines the lowest integer and outputs it. However, in the second case, the '0' should not be part of the array of integers; it acts only as a trigger. So in the scenario:
5 4 9 0 � the program should output 4, not 0
And the issue you are having now is that your program does output the zero.
Assuming that is a correct summary, your program is outputting zero because you are not allowing for (i.e. dealing with) the initialization values of the array. When you create the array, it is initializing all the ints in the array to zero. Try the following experiment to see what I mean:
Notice it prints out: 99 0 0 0 0 0 0 0 0 0 even though I only put the value 99 in.
So in your code, you have all those zeros in your array when you break out of the inout loop before filling the array with inputted values. So when you check for the smallest value in this scenario, you need to stop checking when you hit the last inputted value, otherwise all those zeros are taken into consideration.
So, when you break out of the loop that gets your input values, you need to store the index value of the last inputted character in some attribute, such as lastIndex. Then in your "Find smallest integer" block of code, you need to stop either when you reach that lastIndex value, or when you reach the end of the array.
Be sure to consider all possible extraneous situations: for example, what happens if the first (and thus only) value the user inputs is zero � make sure such a scenario does not crash your program. Also make sure the user can still enter all 30 values without any problems.
Give that a try and if you are still having problems, post your code and someone can help you out; but it will help you learn better if you take the next step -- of determining the code specifics -- on your own.
Good Luck.