Java program to find greatest between three number using Ternary operator

greatest between three numbers

import java.util.*;
class scan
{
 public static void main(String arg[])
  {
   int x,y,z,a;
   System.out.println("Enter First Number:- ");
   Scanner kb=new Scanner(System.in);
   x=kb.nextInt();
   
   System.out.println("Enter Second Number:- ");
   y=kb.nextInt();
   
   System.out.println("Enter Third Number:- ");
   z=kb.nextInt();
   
   a=(x>y && x>z ? x:y>z ? y:z);
   
   System.out.println("Greatest number is:- "+a);
  }
 
}

OUTPUT:-

greatest between three numbers

8 comments on “Java program to find greatest between three number using Ternary operator

  1. education school

    Great article! This is the type of info that are meant to be shared around the web. Disgrace on Google for no longer positioning this submit higher! Come on over and discuss with my website . Thanks =)

    Reply
  2. med web

    This is the right web site for anybody who really wants to find out about this topic. You realize so much its almost hard to argue with you (not that I actually would want to‚ĶHaHa). You certainly put a new spin on a topic that’s been written about for years. Great stuff, just wonderful!

    Reply
  3. best buy electronics

    Hey there! I’ve been following your blog for a long time now and finally got the bravery to go ahead and give you a shout out from New Caney Tx! Just wanted to tell you keep up the excellent job!

    Reply
  4. business

    What’s up everyone, it’s my first pay a quick visit at this website, and post is actually fruitful in favor of me, keep up posting these types of articles or reviews.

    Reply
  5. education advice

    You could definitely see your skills within the article you write. The world hopes for even more passionate writers like you who aren’t afraid to mention how they believe. Always follow your heart.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *