Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/purvgwtw/public_html/tutorials/common.php on line 7
Find Smallest Number
Sponsered Links
Categories
Sponsered Links

Find Smallest Number

Through the given code, we are finding the smallest number from the array of numbers.

public class SmallestNumber{
    public static void main(String[] args) {

        int []num={5,7,6,1,9,20};
        int min = num[0];
        for (int i=1; i<num.length; i++) {
            if (num[i]< min) {
                min = num[i];
            }
        }
        System.out.println("Smallest Number: "+min);
    }
}
 

Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2014 PURVACOMPUTERS.COM All Right Reserved