Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to do the maximum of three numbers in java

public class Example {
   public static void main(String args[]) {
      int num1 = 15;
      int num2 = -5;
      int num3 = 7;
      if (num1 >= num2 && num1 >= num3)
         System.out.println( num1 + " is the maximum number.");
      else if (num2 >= num1 && num2 >= num3)
         System.out.println( num2 + " is the maximum number.");
      else
         System.out.println( num3 + " is the maximum number.");
   }
}
Comment

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
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: how to declare an array in java 
Java :: java parse unix timestamp 
Java :: java load image 
Java :: get distance from latitude and longitude code android 
Java :: java replace all not number 
Java :: java divisible by operator 
Java :: javafx resizable window 
Java :: select in selenium java 
Java :: why are there no destructors in java? 
Java :: sqlexception 
Java :: java get number of threads 
Java :: how to add input in array java 
Java :: how to make a copy of an array java 
Java :: java convert to roman numerals 
Java :: base64 in java 
Java :: java how to make a number 
Java :: java stream distinct by object atribute 
Java :: String remove duplicate in java 
Java :: how to use deque as stack or queue in java? 
Java :: root to leaf sum leetcode 
Java :: android xml hide 
Java :: load file as string java 
Java :: Java Create a ConcurrentHashMap 
Java :: java Write a program to reverse an array or string 
Java :: Instant class java 
Java :: java arraylist deepcopy 
Java :: How to find the logged-in user in Spring Boot? 
Java :: java append file 
Java :: Java Read a Line of Text Using Scanner 
Java :: AndroidManifest.xml could not be found. 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =