Skip to content

Instantly share code, notes, and snippets.

@arielmagbanua
Created September 17, 2021 07:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arielmagbanua/99eee7a023503e684a9aab4cf2f66ce1 to your computer and use it in GitHub Desktop.
Save arielmagbanua/99eee7a023503e684a9aab4cf2f66ce1 to your computer and use it in GitHub Desktop.
Vowels / Consonants

Vowels / Consonants

Write a Java program that counts the vowels and consonants of a input string.

Starter Code

public class App {
    public static void main(String[] args) throws Exception {
        // scanner
        Scanner scanner = new Scanner(System.in);

        // get the input string

        // count the vowels and consonants

        // print the result
        
        scanner.close();
    }
}

Output

Enter a string: Hello World
vowels: 3
consonants: 7
Enter a string: HeLLo WorlD
vowels: 3
consonants: 7
Enter a string: THE QUICK BROWN FOX
vowels: 5
consonants: 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment