003-002-004

Comparison Operators: Number Comparison Program

Easy

Problem Description

Comparison Operators: Number Comparison Program

Learning Objective: Learn how to compare two numbers using comparison operators

Create a program that compares two numbers and displays the comparison results.

Input

Line 1: First number (integer)
Line 2: Second number (integer)

Output

A > B: [true/false]
A < B: [true/false]
A == B: [true/false]

Test Cases

※ Output examples follow programming industry standards

Input:
10
5
Expected Output:
A > B: true
A < B: false
A == B: false
Input:
5
5
Expected Output:
A > B: false
A < B: false
A == B: true
❌ Some tests failed
❌ エラー発生

Your Solution

Current Mode: My Code
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// 計算用に2つの数値をユーザーから入力
int a = sc.nextInt();
int b = sc.nextInt();
// 比較演算子で比較
boolean isGreater = a > b;
boolean isLess = a < b;
boolean isEqual = a == b;
// 計算結果をコンソール出力に表示
System.out.println("A > B: " + isGreater);
System.out.println("A < B: " + isLess);
System.out.println("A == B: " + isEqual);
}
}

0 B / 5 MB

You have 10 free executions remaining