QBasic Programming

WAP to input any string and display only vowels

CLS
INPUT "ENTER ANY STRING"; S$
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
C$ = UCASE$(B$)
IF C$ = "A" OR C$ = "E" OR C$ = "I" OR C$ = "O" OR C$ = "U" THEN
PRINT B$
END IF
NEXT I
END

USING SUB PROCEDURE

DECLARE SUB DISPV (S$)
CLS
INPUT "ENTER ANY STRING"; S$
CALL DISPV(S$)
END

SUB DISPV(S$)
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
C$ = UCASE$(B$)
IF C$ = "A" OR C$ = "E" OR C$ = "I" OR C$ = "O" OR C$ = "U" THEN
PRINT B$
END IF
NEXT I
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION DISPV (S$)
CLS
INPUT "ENTER ANY STRING"; S$
VC = DISPV(S$)
END

FUNCTION DISPV(S$)
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
C$ = UCASE$(B$)
IF C$ = "A" OR C$ = "E" OR C$ = "I" OR C$ = "O" OR C$ = "U" THEN
PRINT B$
END IF
NEXT I
END FUNCTION

WAP to input any string and count total no. of vowels (Prev Lesson)
(Next Lesson) WAP to input any string and count total no. of consonants
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!