QBasic Programming

WAP to enter any 10 numbers and find the sum of numbers

CLS
FOR I = 1 TO 10
INPUT "ENTER THE NUMBERS"; N(I)
S = S + N(I)
NEXT I
PRINT "SUM OF 10 NUMBERS"; S
END

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

SUB SUM (N())
FOR I = 1 TO 10
S = S + N(I)
NEXT I
PRINT "SUM OF 10 NUMBERS"; S
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION SUM (N( ))
CLS
FOR I = 1 TO 10
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
PRINT "SUM OF 10 NUMBERS"; SUM(N( ))
END
FUNCTION SUM (N())
FOR I = 1 TO 10
S = S + N(I)
NEXT I
SUM = S
END FUNCTION

WAP TO ENTER ANY DIGIT AND DISPLAY CUBE OF ODD DIGITS (Prev Lesson)
(Next Lesson) WAP to enter any 10 numbers and find the sum of odd numbers
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!