003-002-010
Basic Comparison Operators
Easy
Problem Description
Basic Comparison Operators
In this problem, you will create a program that reads two integers from standard input, applies all six comparison operators (==, !=, <, >, <=, >=) to compare them, and displays the results to standard output.
Learning Objective: Understand how to use equality (==, !=) and relational (<, >, <=, >=) operators
Overview
Read two integers from standard input, compare them, and output the result of each comparison operator.
Specifications
- Read integer
afrom line 1 and integerbfrom line 2 via standard input - Output results of ==, !=, <, >, <=, >= in order
Input Format
a
b
Output Format (when a=10, b=5)
10 == 5: false
10 != 5: true
10 < 5: false
10 > 5: true
10 <= 5: false
10 >= 5: true
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up