Example 1: Check whether an alphabet is vowel or consonant using if..else statement fun main(args: Array<String>) { val ch = 'i' val vowelConsonant = if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch ==
We can use elem function in Haskell to check whether the given alphabet is vowel or consonant. In the first example, we are going to use (isVowel c = c `elem` "aeiouAEIOU") function. And in other examples, we're going to use elem function along with certain if-else statements, ...
To check whether a character is a vowel or consonant case-insensitively in Kotlin, we can use a simplewhen()expression: funisVowel(c:Char):Boolean{returnwhen(c.lowercaseChar()) {'a','e','i','o','u'->trueelse->false} }
Given a character, we have to check whether it is vowel or consonant. Example: Input: ch = 'A' Output: 'A' is a vowel. Input: ch = 'H' Output: 'H' is a consonant. Program to check whether a character is vowel or consonant in Kotlin ...
System.out.print(character+" is a Vowel"); }else{ System.out.print(character+" is a Consonant"); } } } Output: Enter an Alphabet : g g is a Consonant That’s all about Java Program to Check a Character is Vowel or Consonant....
Sample Output:Example output when input = "A": The character 'A' is a vowel. Example output when input = "e": The character 'e' is a vowel. Example output when input = "p": The character 'p' is a consonant. Explanation:In the above exercise - ...
C++ code to check if the character is vowel or consonant using class and object approach#include <iostream> using namespace std; // create a class class Vowel { // private char data member private: char character; // public function with a char type parameter public: void vowel(char c...
The alphabets A, E, I, O and U (smallcase and uppercase) are known as Vowels and rest of the alphabets are known as consonants. Here we will write a java program that checks whether the input character is vowel or Consonant using Switch Case in Java. If
Write a program using Python that accepts a character as an input. The program should check using the nested decision statements and check the following: If the character is an alphabet, then it should check if it is a vowel or cons...
how to check between two common strings one vowel missing and one consonant is different and rest of the letters are same. please help ex :- string1 : ABCDEFGH string2 : ABCDFGK Hi Chanti please try below code static void Main() ...