Monday, October 11, 2021

Write a Program to Enter any two numbers and display the sum

QBASIC Program to get any two numbers from the user and print their sum on the screen. 

CLS
INPUT "Enter First Number: "; a
INPUT "Enter Second Number: "; b 
s=a+b 
PRINT "Sum = "; s 
END


Using SUB Procedure

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

SUB sum(a,b)
s=a+b
PRINT "Sum = "; s 
END SUB 


Using FUNCTION Procedure

DECLARE FUNCTION sum(a,b)
CLS
INPUT "Enter First Number: "; a
INPUT "Enter Second Number: "; b 
s = sum(a,b)
PRINT "Sum = "; s 
END

FUNCTION sum(a,b)
s = a+b
sum = s
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...