Wednesday, September 11, 2013

Java Program 007

Write java Code For printing Smallest of two given floating point numbers.

public class SmallestOfTwo
{
    public static void main(String[] args)
    {
        Float n1=Float.parseFloat(args[0]);
        Float n2=Float.parseFloat(args[1]);
        
        if(n1<n2)
            System.out.println("Smallest no. is " + n1);
        else
            System.out.println("Smallest no. is " + n2);
            
        System.out.println("Bye,.");
    }
}