Computer Notes, Programming codes, Hardware and Networking Tip, Entertainment, Biography, Internet Tip, Tech News, Latest Technology, YouTube,

Reverse Order (QBASIC Program)

reverse order, reverse order in qbasic, reverse order using function procedure, reverse order using sub procedure, reverse string in qbaic programming,

QBASIC Program to print the given string in reverse order

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

Using SUB .... END SUB

DECLARE SUB revf(s$)
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 ... END FUNCTION

DECLARE FUNCTION rev$(s$)
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


Video Tutorial in Nepali Language

Post a Comment

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget