QBasic Programming

WAP to check whether the supplied character is alphabet or not

CLS
INPUT "ENTER ANY CHARACTER"; A$
B = ASC(A$)
IF B >= 65 AND B <= 90 OR B >= 97 AND B <= 122 THEN
CK$ = "SUPPLIED CHARACTER IS ALPHABET"
ELSE
CK$ = "SUPPLIED CHARACTER IS NOT ALPHABET"
END IF
PRINT CK$
END SUB

USING SUB PROCEDURE
DECLARE SUB CHECK (A$)
CLS
INPUT "ENTER ANY CHARACTER"; A$
CALL CHECK(A$)
END

SUB CHECK (A$)
B = ASC(A$)
IF B >= 65 AND B <= 90 OR B >= 97 AND B <= 122 THEN
CK$ = "SUPPLIED CHARACTER IS ALPHABET"
ELSE
CK$ = "SUPPLIED CHARACTER IS NOT ALPHABET"
END IF
PRINT CK$
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION CHECK$ (A$)
CLS
INPUT "ENTER ANY CHARACTER"; A$
PRINT CHECK$(A$)
END

FUNCTION CHECK$ (A$)
B = ASC(A$)
IF B >= 65 AND B <= 90 OR B >= 97 AND B <= 122 THEN
CK$ = "SUPPLIED CHARACTER IS ALPHABET"
ELSE
CK$ = "SUPPLIED CHARACTER IS NOT ALPHABET"
END IF
CHECK$ = CK$
END FUNCTION

WAP to count the frequency of characters R or S present in the supplied string (Prev Lesson)
(Next Lesson) WAP to enter any ten strings and display the longest strings
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!