WAP using INPUT statement to find the difference of two numbers. QBASIC
Answers
Answered by
2
Required Answer:-
Question:
- Write a program in QBASIC to input two number and find their difference.
Solution:
Here is the code.
CLS
DIM A AS INTEGER
DIM B AS INTEGER
INPUT "Enter First Number: ", A
INPUT "Enter Second Number: ", B
D = A - B
PRINT "Difference Between The Two Numbers is: " + D
END
Explanation:
In this program, we will take two numbers as input, find the difference and display it.
To take input, the INPUT statement is used in QBASIC.
Syntax: INPUT "Text you can give", VARIABLE
Here, we have taken 2 variables as input from the user. The user gives input and it is stored in two variables named A and B. Difference between these two numbers has been stored in variable D. Now, it's time to print.
Similar questions