Answers for "Find the largest among 3 user entered nos. at the command prompt using Java"

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

Code answers related to "Find the largest among 3 user entered nos. at the command prompt using Java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language