Qbasic Program To Find The Average Of Three Numbers

 Qbasic Program To Find The Average Of Three Numbers 

Qbasic Program To Find The Average Of Three Numbers



Algorithm To Find The Average of Three Numbers
Step1: Start
Step2: Accept/Input any three numbers and store them in three different variables, a, b, c
Step3: Calculate avergae=(a+b+c)/3
Step4: Display the average number
Step5: End the program

Qbasic Program To Find The Average Of Three Numbers 

CLS
INPUT” Enter the first number”; a
INPUT” Enter the second number”; b
INPUT” Enter the third number”; c
LET Average = (a+b+c)/3
PRINT” The average number is ”; Average 
END

Algorithm To Find The Average of Three Numbers Using Sub Procedure in QBASIC

Step1: Start
Step2: Declare the sub procedure with a name and parameters as Average (a, b, c)
Step3: Accept/Input any three numbers and store them in three different variables, a, b, c
Step4: Call the sub procedure declared in the step2 with CALL statement as CALL Average(a, b, c)
Step5: End the program
Step6: Define the sub procedure
Step7: In the sub procedure, calculate the average number
Step8: Display the average number
Step9: End the sub procedure


Qbasic Program To Find The Average Of Three Numbers Using FUNCTION Procedure

DECLARE FUNCTION AVG (a, b, c)

CLS
INPUT” Enter the first number”; a
INPUT” Enter the second number”; b
INPUT” Enter the third number”; c
PRINT” The average number is ”; AVG (a, b, c)
END
FUNCTION AVG (a, b, c)
Average= (a + b + c)/3
AVG= Average
END FUNCTION

Algorithm To Find The Average of Three Numbers Using Function Procedure in QBASIC

Step1: Start
Step2: Declare the function procedure with name and parameters as Average (a, b, c)
Step3:  Accept/Input any three numbers and store them in three different variables, a, b, c
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 average number
Step8: Assign the value of the average number to the function name
Step9: End the function procedure


 Qbasic Program To Find The Average Of Three Numbers Using SUB Procedure

DECLARE SUB AVG (a, b, c)

CLS
INPUT” Enter the first number”; a
INPUT” Enter the second number”; b
INPUT” Enter the third number”; c
CALL AVG (a, b, c)
END
SUB AVG (a, b, c)
Average= (a + b + c)/3
PRINT " The average is "; Average
     END SUB

Comments