SHARE
TWEET

Vowel Search (user input)

heysoul_sisypus Jan 19th, 2020 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package javaapplication328;
  2. import java.util.*;
  3. /**
  4.  *
  5.  * @author Medina
  6.  */
  7. public class JavaApplication328 {
  8. //
  9.     //
  10.     public static void main(String[] args) {
  11.         Scanner scan = new Scanner (System.in);
  12.         System.out.print("Input character string: ");
  13.         String str = scan.next();
  14.         str=str.toLowerCase();
  15.         char c = ' ';
  16.         int vowel = 0;
  17.         for(int i=0;i<str.length();i++)
  18.         {c=str.charAt(i);
  19.         if (c=='a'||c=='e'||c=='i'||c=='o'||c=='u'){vowel++;}
  20.         }
  21.         System.out.print("There are: "+vowel+" vowel/s");
  22.     }
  23.    
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top