Program to know about the relation of the value in QBASIC
In this programs we have to use Logic and Relation operator i.e. AND, IF, THEN, >, < etc.
To find Greater one in two number
CLS
PRINT "Find which number is greater"
INPUT "Enter Two Number"; a, b
IF (a > b) THEN
PRINT "This is Greater Number"; a
ELSE
PRINT "This is Greater Number"; b
END IF
END
To find Smaller one in two number
CLS
PRINT "Find which number is Smaller"
INPUT "Enter Two Number"; a, b
IF (a < b) THEN
PRINT "This is Smaller Number"; a
ELSE
PRINT "This is Smaller Number"; b
END IF
END
To find Greater one in three number using AND operator
CLS
PRINT "Find which number is Greatest"
INPUT "Enter Three Number"; a, b, c
IF (a > b AND a > c) THEN
PRINT "Greatest Number"; a
ELSE IF (b > a AND b > c) THEN
PRINT "Greatest Number"; b
ELSE IF (c > a AND c > b) THEN
PRINT "Greatest Number"; c
END IF
END IF
END IF
To find Smaller one in Four number using AND operator
CLS
PRINT "Find which number is Smallest"
INPUT "Enter Four Number"; a, b, c, d
IF (a < b AND a < c AND a < d) THEN
PRINT "Smallest Number"; a
ELSE IF (b < a AND b < c AND b < d) THEN
PRINT "Smallest Number"; b
ELSE IF (c < a AND c < b AND c < d) THEN
PRINT "Smallest Number"; c
ELSE IF (d < a AND d < b AND d < c) THEN
PRINT "Smallest Number"; d
END IF
END IF
END IF
END IF
0 Comments
Thank You ! For your love