Computer Science, asked by ruchi396, 1 year ago

write a program in Java to find the greatest of three numbers using the ternary operator

Answers

Answered by Incredible29
6
Heya user
Here is your answer !!

___________

import java.util.* ;
public class Greatest
{
public static void main ( String args [] )
{
Scanner in = new Scanner ( System.in ) ;
System.out.println ( " Enter three numbers " ) ;
int a = in.nextInt();
int b = in.nextInt();
int c = in.nextInt();
int g = ( a > b ) ? a : b ;
int G = ( g > c ) g : c ;
System.out.println ( " Greatest : " + G ) ;
}
}

___________

Hope it helps !!

Incredible29: plz follow if u lyk my answer
ruchi396: haha!!!!yeah,I'm following and even thanks for this also
Incredible29: u r welcm
Similar questions