write a program in java to display the maximum and minimum number between two numbers
Answers
Answered by
1
Answer:
import java.util.Scanner;
public class MinMax {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter first number: ");
int n1 = sc.nextInt();
System.out.print("Enter second number: ");
int n2 = sc.nextInt();
System.out.println("Minimum number is "+Math.min(n1, n2).toString()+" and maximum number is "+Math.max(n1, n2).toString());
sc.close();
}
}
Similar questions