25. JAVA Program To Find Smallest Number From The Given Two Numbers.
How does this program work?
- In this program you are going to learn about how to find Smallest of given two numbers using JAVA.
- In this program compare two numbers by using if statement, then we get the Output.
Here is the code
// To check smallest of two numbers.
import java.util.Scanner;public class Number
{
public static void main(String args[])
{
int a,b;
System.out.println("Enter Two numbers\n");
Scanner obj=new Scanner(System.in);
a=obj.nextInt();
b=obj.nextInt();
//Print the minimum of two numbers
System.out.println( "The smallest values is "+Math.min(a, b) );}
}