write a program to input 3 on equal numbers and display the second smallest number sample input 65, 41,98 sample output 65
Answers
Answered by
3
Answer:
Good Night & Sweet dreams ⚘
Explanation:
Import java.util.*;
class Sample
{
public static void main(String args[ ])
{
Scanner obj= new Scanner(System. in);
int a,b,c,big,small;
System. out.println("Enter a Number");
a=obj.nextInt( );
System. out.println("Enter a Number");
b=obj.nextInt( );
System. out.println("Enter a Number");
c=obj.nextInt( );
if(a>b && a>c)
{
big=a;
}
else if(b>c)
{
big=b;
}
else
{
big=c;
}
if(a<b && a<c)
{
small=a;
}
else if(b<c)
{
small=b;
}
else
{
small=c;
}
System. out.println("Greatest Number"+big);
System. out.println("Smallest Number"+small);
}
}
Similar questions