Output:
Click Here For Java Online Compiler
Solution:
*** Largest of 3 Number Using Nested If *** The Three Numbers are: 103, 120, 70. The largest number is: 120
Click Here For Java Online Compiler
Solution:
public class LargestOf3NumbersUsingNestedIf { public static void main(String[] args) { int num1 = 103, num2 = 120, num3 = 70; System.out.println("*** Largest of 3 Number Using Nested If ***" + "\n"); System.out.println("The Three Numbers are: " + num1 + ", " + num2 + ", " + num3 + "."); System.out.println(); if (num1 >= num2) { if (num1 >= num3) { System.out.println("The largest number is: " + num1); } else { System.out.println("The largest number is: " + num3); } } else { if (num2 >= num3) { System.out.println("The largest number is: " + num2); } else { System.out.println("The largest number is: " + num3); } } } }
comment 0 comments:
more_vertsentiment_satisfied Emoticon