CLS
INPUT "Enter any String "; s$
FOR i = LEN(s$) TO 1 STEP -1
r$ = MID$(s$, i, 1)
b$ = b$ + r$
NEXT i
PRINT "Reverse Order = "; b$
END
INPUT "Enter any String "; s$
FOR i = LEN(s$) TO 1 STEP -1
r$ = MID$(s$, i, 1)
b$ = b$ + r$
NEXT i
PRINT "Reverse Order = "; b$
END
Using SUB Procedure
DECLARE SUB revf(s$)
CLS
INPUT "Enter any String "; s$
CALL rev(s$)
END
CLS
INPUT "Enter any String "; s$
CALL rev(s$)
END
SUB rev (s$)
FOR i = LEN(s$) TO 1 STEP -1
r$ = MID$(s$, i, 1)
b$ = b$ + r$
NEXT i
PRINT "Reverse Order = "; b$
END SUB
Using FUNCTION Procedure
DECLARE FUNCTION rev$(s$)
CLS
INPUT "Enter any string "; s$
re$ = rev$(s$)
PRINT "Reverse Order = "; re$
END
CLS
INPUT "Enter any string "; s$
re$ = rev$(s$)
PRINT "Reverse Order = "; re$
END
FUNCTION rev$ (s$)
FOR i = LEN(s$) TO 1 STEP -1
r$ = MID$(s$, i, 1)
b$ = b$ + r$
NEXT i
rev$ = b$
END FUNCTION
No comments:
Post a Comment
If you have any doubts, Please let me know.