Answer to Question #270848 in Java | JSP | JSF for Bjoy

Question #270848

Create a program that will read the values of A and B. Compare the two values of A & B then print which of the values is higher including the remark "Higher".

1
Expert's answer
2021-11-24T14:11:56-0500
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int A;
		int B;
		System.out.print("Enter A: ");
		A=in.nextInt();
		System.out.print("Enter B: ");
		B=in.nextInt();
		
		if (A>B)
		System.out.println("A is higher");
		else
		System.out.println("B is higher");
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS