Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Q 3,6
- public class Main
- {
- public static void main(String[] args) {
- int a = 5, b = 1 , c = 10;
- int max_two = (a>b) ? a : b;
- int max_three = (a>b) ? (a>c ? a : c) : b;
- System.out.println("Greatest of two number is "+max_two);
- System.out.println("Greatest of three number is "+max_three);
- }
- }
- /*
- Output
- Greatest of two number is 5
- Greatest of three number is 10
- */
Add Comment
Please, Sign In to add comment