Java program to find minimum number using math class

Java program to find lowest number using math class

Java program to find minimum number using math operation

Java program to find minimum number using math.min

Program:-

import java.util.Scanner;

class group{
public static void main(String angt[]){
Scanner data = new Scanner(System.in);
int num1,num2,num;
System.out.println("Enter 1st number");
num1=data.nextInt();
System.out.println("Enter 2nd number");
num2=data.nextInt();
// Finding min number
num=Math.min(num1,num2);
System.out.println("min number:"+num);
}
}

Output:-

Enter 1st number
5
Enter 2nd number
2
min number:2

Output:-

Enter 1st number
5
Enter 2nd number
8
min number:5

Output:-

Enter 1st number
8
Enter 2nd number
8
min number:8


Learn Java:-
Java codes

Java Programs:-
List of Java Programs

Leave reply

Add your comments here

Back to Top