Monday, October 11, 2021

Write a Program to Enter any two numbers and print average number

QBASIC Program to get any two numbers from the user and print the average. 

CLS
INPUT "Enter First Number: "; a
INPUT "Enter Second Number: "; b 
av=(a+b)/2
PRINT "Average = "; av 
END


Using SUB Procedure

DECLARE SUB avrg(a,b) 
INPUT "Enter First Number: "; a
INPUT "Enter Second Number: "; b 
CALL avrg(a,b) 
END

SUB avrg(a,b)
av=(a+b)/2
PRINT "Average = "; av 
END SUB 


Using FUNCTION Procedure

DECLARE FUNCTION avrg(a,b)
CLS
INPUT "Enter First Number: "; a
INPUT "Enter Second Number: "; b 
av = avrg(a,b)
PRINT "Average = "; av 
END

FUNCTION avrg(a,b)
av = (a+b)/2
sum = av
END FUNCTION

No comments:

Post a Comment

If you have any doubts, Please let me know.

[Download PDF] Computer Science Book Gread-10 in Nepali Language

 If you are searching for class 10 Computer Science in Nepali pdf for free download then you are at the right page. This book is soley publi...