QBASIC PROGRAM TO FIND SUM OF NUMBERS USING DATA

QBASIC PROGRAM TO FIND SUM OF NUMBERS USING DATA



CLS
 DATA 9,6,93,25
 FOR P = 1 TO 4 STEP 1
 READ w
 sum = sum + w
 NEXT P
 PRINT sum
 END

USING SUB


DECLARE SUB ADD()
 CLS
 CALL ADD
 END
 
 SUB ADD
 DATA 9,6,93,25
 FOR P = 1 TO 4 STEP 1
 READ w
 sum = sum + w
 NEXT P
 PRINT sum
 END SUB

Post a Comment

0 Comments