Computer for SEE and NEB

It is a complete SEE and NEB solution for computer science. It includes Computer Fundamentals, Database (SQL), Programming in C QBASIC, CSS, JavaScript, and PHP for beginners.

Breaking

Post Top Ad

Your Ad Spot

Friday, December 2, 2022

QBASIC program to display the product of input two numbers

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

Post Top Ad

Your Ad Spot

Pages