write a program to input 3 on equal numbers and display the second smallest number sample input 65 4198 sample output 65
Answers
Answered by
3
Answer:
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
Social Sciences,
4 months ago
Math,
4 months ago
Social Sciences,
4 months ago
English,
9 months ago
Political Science,
1 year ago