WAP to find greater number between two numbers.
import java.util.Scanner;
class greater{
public static void main(String[] args){
int a,b;
Scanner input=new Scanner(System.in);
System.out.println("Enter A: ");
a=input.nextInt();
System.out.println("Enter B: ");
b=input.nextInt();
if(a>b)
System.out.println("A is greater");
else
System.out.println("B is greater");
}
}
Output : Enter A: 34
Enter B: 35
B is greater
Here, if a is greater than b, then Output will be "A is greater". Otherwise, Output will be "B is greater". In no case are they both output display.