write a program to input three number and display the largest and smallest among them using method of maths class
Answers
Answered by
2
Answer:
important java .until.*;
public class MaxMin
{
public static void main (String [] args)
{
Scanner.sc=new Scanner (System.in);
int a,b,c;
System.out.println("Enter first side:");
a=in.nextInt();
System.out.println("Enter second side:");
b=in.nextInt();
System.out.println("Enter third side:");
c=in.nextInt();
int MAX=Math.max a,(Math.max(b,c));
int MIN=Math.min a,(Math.min(b,c));
System.out.println("Greatest number:"+MAX);
System.out.println("Smallest number:"+MIN);
}
}
❆Sample input❆
87, 65, 34
❆Sample output❆
Greatest number:87
Smallest number:34
❆Detales about program❆
As told Math.min() and Math.max() function is used✓
program is written using scanner class
As told program is written using java language✓
Similar questions
Accountancy,
1 month ago
Science,
1 month ago
Political Science,
1 month ago
Math,
2 months ago
Math,
9 months ago
Math,
9 months ago
Physics,
9 months ago