Write a program to compare between two user given numbers (Using If-then-Elseif).
Answers
Answered by
5
Answer:
CLS
INPUT A
INPUT B
IF A>B
THEN PRINT "GREATER";A
ELSE IF B>A
THEN PRINT "GREATER";B
ELSE
PRINT "EQUAL"
END
Answered by
2
Solution:
This is written in QBASIC.
CLS
INPUT "Enter first number: "; A
INPUT "Enter second number: "; B
IF A > B THEN
PRINT "First number is greater.";
ELSE
PRINT "Second number is greater.";
END IF
END
Logic:
- Take two numbers as input.
- Check if A>B or not. If true, print - First number is greater or else, print - Second number is greater.
See the attachment for output.
•••♪
Attachments:
Similar questions