QBASIC PROGRAM TO PRINT NUMBERS IN ASCENDING ORDER
CLS
DIM N(10)
FOR I = 1 TO 10
INPUT ENTER THE NUMBERS; N(I)
NEXT I
FOR I = 1 TO 10
FOR J = 1 TO 10 - I
IF N(J) > N(J + 1) THEN SWAP N(J), N(J + 1)
NEXT J
NEXT I
PRINT NUMBERS ARRANGED IN ASCENDING ORDER
FOR I = 1 TO 10
PRINT N(I)
NEXT I
END
DECLARE SUB ASCEND(N())
CLS
DIM N(10)
FOR I = 1 TO 10
INPUT ENTER THE NUMBERS; N(I)
NEXT I
CALL SUB ASCEND(N())
END
SUB ASCEND(N())
FOR I = 1 TO 10
FOR J = 1 TO 10 - I
IF N(J) > N(J + 1) THEN SWAP N(J), N(J + 1)
NEXT J
NEXT I
PRINT NUMBERS ARRANGED IN ASCENDING ORDER
FOR I = 1 TO 10
PRINT N(I)
NEXT I
END SUB
0 Comments