QBASIC PROGRAM TO FIND REVERSE OF A STRING

QBASIC PROGRAM TO FIND REVERSE OF A STRING



CLS
 INPUT "ENTER ANY STRING"; S$
 FOR I = LEN(S$) TO 1 STEP -1
 B$ = MID$(S$, I, 1)
 W$ = W$ + B$
 NEXT I
 PRINT "REVERSED STRING IS "; W$
 END

USING SUB


DECLARE SUB REVERSE(S$)
 CLS
 INPUT "ENTER ANY STRING"; S$
 CALL REVERES(S$)
 END
 
 SUB REVERSE(S$)
 FOR I = LEN(S$) TO 1 STEP -1
 B$ = MID$(S$, I, 1)
 W$ = W$ + B$
 NEXT I
 PRINT "REVERSED STRING IS "; W$
 END SUB

Post a Comment

0 Comments