Qbasic program to print the numbers which are divisible by 5 and 7 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 AND 7 ARE"
FOR I = 1 TO 15
IF N(I) MOD 5 = 0 AND N(I) MOD 7 = 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 AND 7 ARE"
FOR I = 1 TO 15
IF N(I) MOD 5 = 0 AND N(I) MOD 7 = 0 THEN PRINT N(I)
NEXT I
END SUB
0 Comments