Friday 11 October 2013

Biggest of 3 numbers using conditional operator witout using && || !=


Program
---------
import java.util.Scanner;
class demo
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
int a,b,c,big;
System.out.println("Enter 3 numbers");
a=s.nextInt();
b=s.nextInt();
c=s.nextInt();
big= a>b ? (a>c ? a : c) : (b>c ? b : c);
System.out.println(big);
}
}

No comments:

Post a Comment