Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

MAXIMUM OF THE 2 NUMBERS IN JAVA

import java.util.*;
public class maximum
{
    public static void main()
    {
        System.out.println("ENTER THE TWO NUMBER TO CHECK THE MAXIMUM ONE");
        Scanner a = new Scanner (System.in);
        int b  = a.nextInt();
        int c = a.nextInt();
        if (b>c)
        {
            System.out.println("MAXIMUM BETWEEN "+b+" and "+c+ " is " +b);
        }
        else if (c>b)
        {
            System.out.println("MAXIMUM BETWEEN "+b+" and "+c+ " is " +c);
        }
        else 
        {
            System.out.println("BOTH ARE EQUAL");
        }
        //MADE BY CodeWithParth
    }
}
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #MAXIMUM #OF #THE #NUMBERS #IN #JAVA
ADD COMMENT
Topic
Name
3+7 =