QBASIC PROGRAM TO PRINT ODD ANUMBERS AND THEIR SUM FROM 1 TO 100
CLS
FOR I = 1 TO 100 STEP 2
PRINT I,
S = S + I
NEXT I
PRINT “SUM OF ALL ODD NUMBERS FROM 1 TO 100=”; S
END
USING SUB
DECLARE SUB SO()
CLS
CALL SO
END
SUB SO
FOR I = 1 TO 100 STEP 2
PRINT I,
S = S + I
NEXT I
PRINT “SUM OF ALL ODD NUMBERS FROM 1 TO 100=”; S
END SUB
0 Comments