Answers for "Java program to find largest of three numbers"

0

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.");
   }
}
Posted by: Guest on December-06-2020
0

how to find the largest number in java

int number1 = 2;
int number2 = 1;
  
System.out.println("The largest number is " + Math.max(number1, number2));
System.out.println("The smallest number is " + Math.min(number1, number2));
Posted by: Guest on March-30-2021
0

Java program to find largest of three numbers using nested if

public class Main{public static void main(String[] args) {double a = 500, b = 1000, c = 1500;if( a >= b && a >= c)System.out.println(a + " largest number");else if (b >= a && b >= c)System.out.println(b + " largest number");elseSystem.out.println(c + " largest number");}}
Posted by: Guest on June-12-2021

Code answers related to "Java program to find largest of three numbers"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language