Friday, January 30, 2015

Working of Conditional Operator in Java


http://indiancomputerwizard.blogspot.in/
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
http://indiancomputerwizard.blogspot.in/

0 comments:

Post a Comment

Blog Archive