QBASIC PROGRAM TO CHECK WHETHER A STRING IS NUMBER,UPPERCASE OR LOWERCASE
QBASIC PROGRAM TO CHECK WHETHER A STRING OR FIRST CHARACTER IS NUMBER,UPPERCASE OR LOWERCASE
CLS
INPUT ENTER ANY STRING; S$
A$ = LEFT$(S$, 1)
B = ASC(A$)
IF B >= 48 AND B <= 57 THEN
CK$ = "FIRST CHARACTER IS A NUMBER"
ELSEIF B >= 65 AND B <= 90 THEN
CK$ = "FIRST CHARACTER IS UPPERCASE"
ELSE IF B >= 97 AND B <= 122 THEN
CK$ = "FIRST CHARACTER IS LOWERCASE"
ELSE
CK$="FIRST CHARACTER IS NEITHER NUMBER, UPPERCASE OR LOWERCASE"
END IF
PRINT CK$
END
USING SUB
DECLARE SUB NUL(S$)
CLS
INPUT ENTER ANY STRING; S$
CALL NUL(S$)
END
SUB NUL(S$)
A$ = LEFT$(S$, 1)
B = ASC(A$)
IF B >= 48 AND B <= 57 THEN
CK$ = "FIRST CHARACTER IS A NUMBER"
ELSEIF B >= 65 AND B <= 90 THEN
CK$ = "FIRST CHARACTER IS UPPERCASE"
ELSE IF B >= 97 AND B <= 122 THEN
CK$ = "FIRST CHARACTER IS LOWERCASE"
ELSE
CK$="FIRST CHARACTER IS NEITHER NUMBER, UPPERCASE OR LOWERCASE"
END IF
PRINT CK$
END SUB
0 Comments