Computer Science, asked by hiru89, 11 months ago

Write a program to enter any alphabet and find out whether the
number is vowel or alphabet.

Answers

Answered by skylog44444
0

Answer:

in visual basic :

first create a text box

then create a command button

name of text box is here thought to be "text1"

name of command button is taken to be "command1"

now open the code window by double clicking on the form.

code:

private sub command1_click()

if text1.text="a" then goto 1

if text1.text="e" then goto 1

if text1.text="i" then goto 1

if text1.text="o" then goto 1

if text1.text="u" then goto 1

goto 2

1:

msgbox("it's a vowel!")

goto 3

2:

msgbox("it's a consonant!")

goto 3

3:

end sub

Explanation:

private sub command1_click()

means the program will perform everything written between "private sub command1_click()" and "end sub" once the command button is clicked.

then the if statements decide if the text entered in the text box is "a" or "e" or "I" or "o" or "u", if it is, then it goes to the block number 1 and performs everything written between the label 1 and label 2 i.e until a new label starts and in this case, it will show a message box telling that the alphabet is a vowel and goto 3 where it closes since there is an "end sub" statement.

but if it's not a variable i.e. not "a" or "e" or "I" or "o" or "u" then it goes to the next line where it finds another statement telling it to goto another block 2, so it continues to block 2 where it finds a msgbox and displays what's written inside that msgbox i.e. " it's a consonant!" and then goes to label 3 and finds end sub and closes.

that's it, hope you can understand it and hope it helps you. :)

Similar questions