Created
October 17, 2024 00:26
-
-
Save PramodDutta/f66224d2c6086889a75c97b58e2c7254 to your computer and use it in GitHub Desktop.
Task 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MaxNumber { | |
public static void main(String[] args) { | |
int num1 = 10; // Example number 1 | |
int num2 = 20; // Example number 2 | |
// Using ternary operator to find maximum | |
int max = (num1 > num2) ? num1 : num2; | |
// Printing the result | |
System.out.println("The maximum of " + num1 + " and " + num2 + " is: " + max); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment