Computer Science, asked by jxavier2105, 10 months ago

Write a program in Java to input two numbers and display the greatest and the smallest of the two numbers.Hint: Use Math.min( ) and Math.max( )Sample Input: 87, 34 Sample Output: Greatest Number 87 Smallest number 34 *

Answers

Answered by thecyrusdavid
5

Answer:

Import.java.util.Scanner*;

Import.java.lang.Math*;

class numbers

{

  Public static void main (String args [] )

       {

              Scanner scan = new Scanner ( system.in );

              System.out.println(“Enter two numbers”);

               int n1 = scan.nextInt();

               int n2 = scan.nextInt();

              // Greatest of 2 numbers

              System.out.println (“The greatest of the two numbers “+n1+” & “+n2+” is “+Math.max(n1,n2));

              System.out.println (“The smallest of the two numbers “+n1+” & “+n2+” is “+Math.min(n1,n2));

        }

        {

             //functionclose

             Public static void main(String args[])

                   {

                        Numbers objectname = new numbers();

                        object name max min [];

                    }

      }

}

Explanation:

this is the answer joel x u come to chs i am cd now  dont bully me

 

Answered by saloni1234sk
0

Answer:

answer of your questions

Attachments:
Similar questions