June 29, 2017

Qbasic program to check the entered character is vowel or consonant

REM to check the entered character is vowel or consonant
CLS
INPUT "Enter a character:", w$
IF LCASE$(w$)="a" OR LCASE$(w$)="e" OR LCASE$(w$)="i" OR LCASE$(w$)="o" OR LCASE$(w$)="u" THEN
PRINT "The character is Vowel"
ELSE
PRINT "The character is consonant"
END IF
END

5 comments:

  1. This program is wrong. I wanted to see what others have done, to find that most of them are wrong. Mine is correct.

    CLS
    REM program to check the given letter is a vowel or consonant
    Input "Enter an alphabet";L$
    IF L$="A" OR L$="E" OR L$="I" OR L$="O" OR L$="U" OR L$="a" OR L$="e" OR L$="i" OR L$="o" OR L$="u" THEN
    PRINT " It is a vowel"
    ELSE
    PRINT " It is a consonant"
    END IF
    END

    Output:-
    Enter an alphabet? A
    It is a vowel
    Or
    Enter an alphabet? R
    It is a consonant

    ReplyDelete
    Replies
    1. I prepared in following way but I don't know why some terms are hidden:

      REM to check the entered character is vowel or consonant
      CLS
      INPUT "Enter a character:", w$
      IF LCASE$(w$)="a" OR LCASE$(w$)="e" OR LCASE$(w$)="i" OR LCASE$(w$)="o" OR LCASE$(w$)="u" THEN
      PRINT "The character is Vowel"
      ELSE
      PRINT "The character is consonant"
      END IF
      END

      Delete
    2. or you can ....
      REM to check the entered character is vowel or consonant
      CLS
      INPUT "Enter a character:", w$
      L$=LCASE$(w$)
      IF L$="a" OR L$="e" OR L$="i" OR L$="o" OR L$="u" THEN
      PRINT "The character is Vowel"
      ELSE
      PRINT "The character is consonant"
      END IF
      END

      Delete
  2. can you WAP top display vowels in a text?

    ReplyDelete
    Replies
    1. Would you mind to specify: Is it from a word or a sentence, just vowel letters should be displayed.

      Delete

Note: Only a member of this blog may post a comment.