CLS
INPUT "enter any letter"; a$
b$ = UCASE$(a$)
SELECT CASE b$
CASE "a", "e", "i", "o", "u"
END SELECT
IF c$ = b$ THEN
PRINT "Vowel"
ELSE
PRINT "consonant"
END IF
END
How to know if the entered letter is a vowel or a consonant
478 Views Asked by Rohit Lohala At
2
There are 2 best solutions below
0
On
You can use the INSTR function to find out if the inputted character is in the list of vowels:
CLS
INPUT "enter any letter"; a$
IF INSTR("AEIOUaeiou", a$) THEN
PRINT "Vowel"
ELSE
PRINT "Consonant"
END IF
END
Not better but feasible is using `UCASE$':
CLS
INPUT "enter any letter"; a$
a$ = UCASE$(a$)
IF INSTR("AEIOU", a$) THEN
PRINT "Vowel"
ELSE
PRINT "Consonant"
END IF
END
If you're going to compare with lowercase letters, be sure to use LCASE$ instead of UCASE$