QBasic Programming

WAP to enter any 5 numbers and display its product

CLS
P = 1
FOR I = 1 TO 5
INPUT "ENTER THE NUMBERS"; N(I)
P = P * N(I)
NEXT I
PRINT "PRODUCT OF 5 NUMBERS"; P
END

USING SUB PROCEDURE
DECLARE SUB PRODUCT (N( ))
CLS
FOR I = 1 TO 5
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
CALL PRODUCT (N( ))
END

SUB PRODUCT (N())
P = 1
FOR I = 1 TO 5
P = P * N(I)
NEXT I
PRINT "PRODUCT OF 5 NUMBERS"; P
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION PRODUCT (N( ))
CLS
FOR I = 1 TO 5
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
PRINT "PRODUCT OF 5 NUMBERS"; PRODUCT (N( ))
END

FUNCTION PRODUCT (N())
FOR I = 1 TO 5
P = P * N(I)
NEXT I
PRODUCT = P
END FUNCTION

WAP to input number and find product of even digits (Prev Lesson)
(Next Lesson) WAP to input three sides of a triangle and determine whether a triangle can be formed or not
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!