QBASIC Program To Find The Difference Of Two Numbers

 QBASIC Program To Find The Difference Of Two Numbers

QBASIC Program To Find The Difference Of Two Numbers



Algorithm To Find The Difference of Two Numbers


Step1: Start
Step2: Accept/Input any two numbers and store them in two different variables a and b
Step3: Calculate difference = a - b
Step4: Display the difference
Step5: End the program

QBASIC Program To Find The Difference Of Two Numbers

CLS
INPUT" Enter first number"; a
INPUT" Enter second number"; b
D=a-b
PRINT" The difference is "; D
END

Algorithm To Find The Difference of Two Numbers Using Sub Procedure in QBASIC

Step1: Start
Step2: Declare the sub procedure with a name and parameters as Difference (a, b)
Step3: Input two numbers a and b
Step4: Call the sub procedure declared in the step2 with CALL statement as CALL Difference (a, b)
Step5: End the program
Step6: Define the sub procedure
Step7: In the sub procedure, calculate the difference
Step8: Display the difference
Step9: End the sub procedure

QBASIC Program To Find The Difference Of Two Numbers Using SUB Procedure

DECLARE SUB Difference(a, b)
CLS
INPUT" Enter first number"; a
INPUT" Enter second number"; b
CALL Difference(a, b)
END
SUB Difference(a, b)
D=a-b
PRINT" The difference is "; D
END SUB

Algorithm To Find The Difference Of Two Numbers Using Function Procedure in QBASIC

Step1: Start
Step2: Declare the function procedure with name and parameters as Difference (a, b)
Step3: Input two numbers a and b
Step4: Call the function procedure declared in the step2 with a variable or PRINT Statement
Step5: End the program
Step6: Define the function procedure
Step7: In the function procedure, calculate the difference
Step8: Assign the value of difference to the function name
Step9: End the function procedure
 

QBASIC Program To Find The Difference Of Two Numbers Using FUNCTION Procedure

DECLARE FUNCTION Difference(a, b)
CLS
INPUT" Enter first number"; a
INPUT" Enter second number"; b
PRINT" The difference is"; Difference(a, b)
END
FUNCTION Difference(a, b)
D=a-b
Difference=D
END FUNCTION

Comments