//https://csprograms4u.blogspot.com/
//Chapter 1
//Program 7
//Conditional Operator to
calculate Max out of 3
import
java.util.Scanner;
public
class CO3
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int a,b,c,max;
System.out.println("Enter First
Number");
a=sc.nextInt();
System.out.println("Enter Second
Number");
b=sc.nextInt();
System.out.println("Enter Third
Number");
c=sc.nextInt();
max=((a>b)?((a>c)?a:c):((b>c)?b:c));
System.out.println("Maximum of 3
is="+max);
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.