//https://csprograms4u.blogspot.com/
//Chapter 2
//Program 6
//Max out of 3 using
if else statement
import
java.util.Scanner;
public
class Max3IfElse
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int a,b,c,max;
System.out.println("Enter three
numbers");
a=sc.nextInt();b=sc.nextInt();c=sc.nextInt();
if(a>b)
{
if(a>c)
{
max=a;
}
else
{
max=c;
}
}
else
{
if(b>c)
{
max=b;
}
else
{
max=c;
}
}
System.out.println("maximum
value="+max);
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.