Smallest Number Example Java Program


Smallest Number Example Program

public class SmallestNumber {
    public static void main(String[] args) {
        int[] array = {88,33,55,23,64,123};
        int smallnum = Integer.MAX_VALUE;
        for(int i =0;i array[i]) {
                smallnum = array[i];
            }
        }
        System.out.println("Smallest number in array is : " +smallnum);
    }
}

Sample Output

Output is:
Smallest number in array is : 23