Write Java Program To Find Maximum Or Minimum Numbers Among Two Numbers...




I/P:-



/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package TUTschool;

import java.util.Scanner;

/**
 *
 * @author lenovo
 */
public class MexorMin {
    public static void main(String args[])
    {
     int a,b;
        System.out.println("Enter Two Integer Numbers:\n");
     Scanner obj=new Scanner(System.in);
     a=obj.nextInt();
     b=obj.nextInt();
     if(a>b)
     {
         System.out.println("The Maximum Number = "+a);
         System.out.println("");
         System.out.println("The Minimum Number = "+b);
     }
     else
     {
         System.out.println("The Maximum Number = "+b);
         System.out.println("");
         System.out.println("The Minimum Number = "+a);
     }
     
    }
}



O/P:-



run:
Enter Two Integer Numbers:

2
3
The Maximum Number = 3

The Minimum Number = 2
BUILD SUCCESSFUL (total time: 3 seconds)

^