Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Supriya Kurian
vowels
1 Answer(s)      4 years ago
Posted in : Java Beginners


program to count the number of vowels in a given array of characters


Advertisement
View Answers

December 23, 2010 at 11:05 AM


Hi Friend,

Try the following code:

import java.util.*;
class CountVowels{
  public static void main(String args[]) throws Exception{
      char ch[]=new char[5];
  Scanner input=new Scanner(System.in);
  System.out.println("Enter 5 characters:");
   for(int i=0;i<ch.length;i++){
       String st=input.next();
       char c=st.charAt(0);
       ch[i]=c;
       }

  int count = 0; 

    for (int i = 0; i < ch.length; i++) {
        if (ch[i]=='a' || ch[i]=='e' || ch[i]=='i' || ch[i]=='o' || ch[i]=='u') {
        count++;
        }
    }
    System.out.println("There are" + " " + count + " " + "vowels in an array.");
}
}

Thanks



Related Tutorials/Questions & Answers:
vowels
vowels  program to count the number of vowels in a given array of characters   Hi Friend, Try the following code: import java.util....++; } } System.out.println("There are" + " " + count + " " + "vowels
vowels
vowels  how do u encryp vowels from given wordes?   import java.util.*; class EncryptVowels { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("Enter
Advertisements
Count Vowels
Count Vowels   Read a string from the user, your program counts the number of vowels in the text and have it report a sum of each vowel found as well as the number of spaces. Make it in two classes
vowels and consonants
vowels and consonants   import java.lang.String; import java.io.*; import java.util.*; public class Vowels{ public static void main(String args[])throws IOException{ File aa = new File("C
NUMBER OF VOWELS IN A WORD
NUMBER OF VOWELS IN A WORD  WRITE A PROGRAM THAT WILL INPUT A WORD THEN IT WILL DETERMINE THE NUMBER OF VOWELS PRESENT IN THE INPUTTED WORD
print word with max vowels
print word with max vowels  if suppose i hava entered a sentence and in that sentence i have to print a word which has maximum vowels in it.... i have tried it but i am not getting it...please help
Java count vowels
Java count vowels In this section you will learn how to count the number of vowels in String. Here you will ask to enter a string of your own choice and then you will get the number of vowels count. Description of code : In this code
ROTATE THE VOWELS IN A STRING!!! - Java Beginners
ROTATE THE VOWELS IN A STRING!!!  Hi Sir, My Question is to rotate the vowels, but not directly. First please read the question below... it changes the "vowel a to e", but doesn't change the rest of vowels, and i really
Java Count Vowels
Java Count Vowels       In this program you will learn how to count vowels in a String. Here you... the number of vowels from that String. Description of the code: In the program code
to read a file and seperate vowels and consonants to other files
to read a file and seperate vowels and consonants to other files  import java.io.*; public class alpha { public static void main(String[] args)throws IOException { try { FileInputStream fstream = new FileInputStream
Display the word that begins with vowel using Java Program
Display the word that begins with vowel using Java Program In this section, we are going to separate the word that begins with vowels from the specified text...*; import java.util.regex.*; public class Vowels { public static void main
Java
Java  program to generate six letters in lower case and check if some of those letters are vowels..please help
STRING.....
STRING.....  plzz sent me d code for counting vowels in a string... gui programme
hi....
hi....  plzz sent me d code for counting vowels in a string... gui programme
string prgm
string prgm  write a java program which read a sentence and print occurence of each vowels in it seperatly
vowel
word/string:"); String str=input.nextLine(); String vowels...'){ vowels+=Character.toString(ch[i])+" "; } } System.out.println("Vowels in the string: "+vowels
java string vowel program
java string vowel program  java string vowel program   Please visit the following links: Display the word that begins with vowel Java Count Vowels
Exercise 17
Exercise 17  Character Counter Write a program which takes an input string and determines the number of vowels, consonants, digits, and special characters (i.e., all other nonalphanumeric characters) in the string
java coding
java coding  i need to to a project in java and the title is file parsing. i need to read a file or if a particular file is given i have to count the no of vowels, pick out some terms, and to display the details about that file
java
java  1) Take a string as input from command line and find the following: a) Length of the string b) number of vowels in it c) number of characters in it d) number of digits in it e) how many uppercase letters are present and how
html
html   HTML document with Javascript to count the number of vowels... MsgBox (str) { var chr = "" var nVowels = 0 //Counting all the vowels. for (pos = 0... " + nVowels + " vowels") document.write("<P>There were " + nVowels
using function
any sentence and print vowels and consonants sepratly   Here is an example that accepts a sentence from the user and display the vowels and consonants...("Vowels are: "); for (int i=0;i<str.length();i++) { ch
full description of program code
); String vowels="",consonants=""; while(stk.hasMoreTokens...")||token.startsWith("u")){ vowels+=token+" "; } else... will store into the string vowels, otherwise the words will get stored
full description of program code
); String vowels="",consonants=""; while(stk.hasMoreTokens...")||token.startsWith("u")){ vowels+=token+" "; } else
Count number of "*"
++; } } System.out.println("The number of vowels in the given sentence
function method
all the vowels if chr is 'v' otherwise, finds its cube.   Here... vowels = "aeiouAEIOU"; String res=""; for( int i = 0... ); System.out.println("Vowels are: "+res); } } public static void main(String
Jsp Choose
anything else, inside a c:choose tag. Here we prompt the user to enter only vowels...;form method="post">Enter only vowels: <input type="text" name="choose... that the entered value is true: But if you enter any alphabet or number other than vowels
working wit string - Java Beginners
java.util.regex.*; public class Vowels { public static void main(String[]args
please help me to solve this question about array
please help me to solve this question about array  write a program thatt stores vowels (a,e,i,o and u)in an array. Ask the user to enter any character. The program should ignore the case of that character (uppercase or lowercase
Java Programs
and inputstreamconstructor, how to count vowels in a string, String indexOf() method
Creating Tree Structure using GWT
;TreeItem root = new TreeItem("Vowels");   root.addItem
 

 

 

DMCA.com