QBASIC program to display the product of input two numbers
CLS
INPUT
"Enter first number:"; x
INPUT
"Enter second number:"; y
p
= x * y
PRINT
"Product of two numbers:"; p
END
By
using SUB procedure (SUB…END SUB)
DECLARE
SUB product (x, y)
CLS
INPUT
"Enter first number:"; x
INPUT
"Enter second number:"; y
CALL
product(x, y)
END
SUB
product (x, y)
p
= x * y
PRINT
"Product of two numbers="; p
END
SUB
By
using FUNCTION procedure (FUNCTION…END FUNCTION)
DECLARE
FUNCTION product (x, y)
CLS
INPUT
"Enter first number:"; x
INPUT
"Enter second number:"; y
PRINT
"product of two numbers="; product(x, y)
END
FUNCTION
product (x, y)
product
= x * y
END FUNCTION
Output:
No comments:
Post a Comment