QBASIC – Easy to find smaller number among two numbers

Table of Contents

View More QBASIC Programs Here

Overview

Below is the program to find the smaller number among any two user-entered numbers.

REM Program to find the smaller number among two numbers
CLS
INPUT "Enter the first number: "; a
INPUT "Enter the second number: "; b
IF a < b THEN
  PRINT a; " is smaller than ";b
ELSE 
  PRINT b; " is smaller than ";a
END IF
END

Output

Outputs 15 is smaller than 20 if inputs are 15 and 20

Explanation

To find the smaller number among two numbers, ask two numbers from the user and check if the first number is smaller than the other using the less than (<) comparison operator.

Leave a Comment

Your email address will not be published. Required fields are marked *

Exit mobile version