003-003-008

Using Comparison Operators

Easy

Problem Description

Using Comparison Operators

Learning Objective: Understand Java's comparison operators (==, !=, <, >, <=, >=) and use them for conditional evaluation

Overview

Create a program that inputs two integers and outputs the results of various comparison operations.

Specifications

  1. Input two integers a and b
  2. Output the following comparison results as true/false:
    • a == b (equal)
    • a != b (not equal)
    • a < b (less than)
    • a > b (greater than)
    • a <= b (less than or equal)
    • a >= b (greater than or equal)

Input Format

10 20

Output Format

a == b: false
a != b: true
a < b: true
a > b: false
a <= b: true
a >= b: false

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?