write a program to smallest number out of 2 numbers in java
Answers
Answered by
2
Explanation:
import java.util.Scanner;
class group{
public static void main(String ang[]){
Scanner data= new Scanner(System.in);
int num1, num2;
// Read 1st number
System.out.println("Enter 1st number");
num1=data.nextInt();
// Read 2nd number
System.out.println("Enter 2nd number");
num2=data.nextInt();
// Find smallest number
if(num1>num2)
System.out.println("The smallest number:"+num2);
else
System.out.println("The smallest number:"+num1);
}
}
Similar questions