QBASIC Program To Find The Sum Of Two Numbers

 QBASIC Program To Find The Sum Of Two Numbers

QBASIC Program To Find The Sum Of Two Numbers


Algorithm To Find The Sum of Two Numbers


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

 
QBASIC Program To Find The Sum Of Two Numbers

CLS
INPUT" Enter the first number"; a
INPUT" Enter the second number"; b
Sum = a+b
PRINT" The sum is "; Sum
END
 
Algorithm To Find The Sum of Two Numbers Using Sub Procedure in QBASIC

Step1: Start
Step2: Declare the sub procedure with a name and parameters as SUM (a, b)
Step3: Input two numbers a and b
Step4: Call the sub procedure declared in the step2 with CALL statement as CALL SUM (a, b)
Step5: End the program
Step6: Define the sub procedure
Step7: In the sub procedure, calculate the sum
Step8: Display the sum
Step9: End the sub procedure
 
QBASIC Program To Find The Sum Of Two Numbers Using SUB Procedure

DECLARE SUB SUM(a, b)
CLS
INPUT" Enter first number"; a
INPUT" Enter second number"; b
CALL SUM(a, b)
END
SUB SUM(a, b)
S=a+b
PRINT" The sum is "; S
END SUB
 
Algorithm To Find The Sum Of Two Numbers Using Function Procedure in QBASIC

Step1: Start
Step2: Declare the function procedure with name and parameters as SUM (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 sum
Step8: Assign the value of sum to the function name
Step9: End the function procedure
 
QBASIC Program To Find The Sum Of Two Numbers Using FUNCTION Procedure

DECLARE FUNCTION SUM(a, b)
CLS
INPUT" Enter the first number"; a
INPUT" Enter the second number"; b
PRINT" The sum is"; SUM(a, b)
END
FUNCTION SUM(a, b)
S=a+b
SUM=S
END FUNCTION

Comments