Thursday, October 17, 2019

134. Qbasic program to input a string then print vowel characters in upper case and consonant characters in lower case


134.      Write a program to input a string then print vowel characters in upper case and consonant characters in lower case using function – end function. (Suppose input string is NEPAL then output should be nEpAl)

DECLARE SUB ALT(S$)
CLS
INPUT "ENTER ANY WORD"; S$
CALL ALT(S$)
END

SUB ALT$ (S$)
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
IF I MOD 2 = 1 THEN
W$ = W$ + LCASE$(B$)
ELSE
W$ = W$ + UCASE$(B$)
END IF
NEXT I
PRINT W$
END SUB

No comments:

Post a Comment