Kartier Pohs

Tuesday, June 16, 2015

Working of Conditional Operator in Java


Working of  Conditional Operator in Java
Working of  Conditional Operator in Java
import java.util.Scanner;
class ConditionalOperator
{
public static void main(String args[])
{
int a,b,c,result;
Scanner input=new Scanner(System.in);
System.out.print("Enter the value of a b and c ");
System.out.println("");
a=input.nextInt();
b=input.nextInt();
c=input.nextInt();
result=(a>b)?((a>c)?a:c):((b>c)?b:c);
System.out.println("The largest no is: "+result);
}
}
OUTPUT
Working of  Conditional Operator in Java

No comments:

Post a Comment

Copyright 2015 @ Yogesh Prasad