Java

Program to check whether an alphabet is vowel or consonant.

Program to check whether an alphabet is vowel or consonant.
import java.util.*;
import java.lang.*;
import java.io.*;

public class VowelConsonant {

    public static void main(String[] args) {

        char ch = 'g';

        if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' )
            System.out.println(ch + " is vowel");
        else
            System.out.println(ch + " is consonant");

    }
}
Nikhil Juneja

Passionate software developer and technical contributor at TutorialsLink.