Answers for "java program to print the largest of three numbers using nested if c"

2

Java program to find the largest in three numbers using nested if

// Java program to find largest of four numbers using nested if
public class LargestNestedIfDemo 
{
   public static void main(String[] args) 
   {
      int num1 = 36, num2 = 35, num3 = 56;
      if(num1 >= num2) 
      {
         if(num1 >= num3)
         {
            System.out.println(num1 + " is largest number.");
         }
         else
         {
            System.out.println(num3 + " is largest number.");
         }
      } 
      else 
      {
         if(num2 >= num3)
         {
            System.out.println(num2 + " is largest number.");
         }
         else
         {
            System.out.println(num3 + " is largest number.");
         }
      }
   }
}
Posted by: Guest on November-02-2020
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 print the largest of three numbers using nested if c"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language