Qbasic program to find / print the numbers which are divisible by 5 among 15 user-input numbers
CLS
DIM N(15)
FOR I = 1 TO 15
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
PRINT "THE NUMBERS WHICH ARE DIVISIBLE BY 5 ARE"
FOR I = 1 TO 15
IF N(I) MOD 5 = 0 THEN PRINT N(I)
NEXT I
END
USING SUB
DECLARE SUB DIVISIBLE(N())
CLS
DIM N(15)
FOR I = 1 TO 15
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
CALL DIVISIBLE(N())
END
SUB DIVISIBLE(N())
PRINT "THE NUMBERS WHICH ARE DIVISIBLE BY 5 ARE"
FOR I = 1 TO 15
IF N(I) MOD 5 = 0 THEN PRINT N(I)
NEXT I
END SUB
0 Comments