QBASIC PROGRAM TO FIND THE SMALLEST NUMBER AMONG 20 NUMBERS USING ARRAY
CLS
DIM N(20)
FOR I = 1 TO 20
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
S = N(1)
FOR I = 2 TO 20
IF N(I) < S THEN S = N(I)
NEXT I
PRINT “THE SMALLEST NUMBER IS”; S
END
USING SUB
DECLARE SUB SMALL(N())
CLS
DIM N(20)
FOR I = 1 TO 20
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
CALL SMALL(N())
END
SUB SMALL(N())
S = N(1)
FOR I = 2 TO 20
IF N(I) < S THEN S = N(I)
NEXT I
PRINT “THE SMALLEST NUMBER IS”; S
END SUB
0 Comments