WAP to find smallest among two numbers using scanner.
2 years ago
OOP Java
Compile code:
import java.util.Scanner;
public class Smallestamongtwonumbers{
public static void main(String args[])
{
int a, b, Smallest;
Scanner scan = new Scanner(System.in);
System.out.print("Enter Two Number : ");
a = scan.nextInt();
b = scan.nextInt();
if(a<b){
Smallest = a;}
else{
Smallest = b;}
System.out.print("Smallest of Two Number is " +Smallest);
}
}
Output:

Dipti KC
Jan 8, 2023