You are here:   HomeJava ProgrammingControl Structures in JavaPrime Number Program in Java Using BufferedReader Example.
by Dinesh Thakur Category: Control Structures

Algorithm for Remove Vowels from a Sentence:

step 1: read String word

step 2: set char array c[]=word. to CharArray()

step 3: create new char array cc[] of size 80

step 4: setj=0

step 5: initialize i=0

step 6: repeat through step-8 while(i<c.length)

step 7: if(c[i]=='a'llc[i]=='e'llc[i]=='i'llc[i]=='o'llc[i]=='u')

then goto step-6

else cc[j]=c[i] , j=j+ 1

step 8: i=i+ 1

step 9: print c

step 10: print cc

step 11: Exit

Here is the Java Example for Remove Vowels from a Sentence:

import java.util.*;

class RemoveVowels
{
                    public static void main(String args[])
           {
                            System.out.print("Please Enter the Sentence : ");
                            Scanner s=new Scanner(System.in);
                            String word=s.nextLine();
                            char[] c=word.toCharArray();
                            char cc[]=new char[80];
                            int j=0;
                            for(int i=0;i<c.length;i++)
                                {
                                    if(c[i]== 'a' || c[i]== 'e' || c[i]=='i' || c[i]== '0' || c[i]== 'u')
                                      {
                                          continue;
                                      }
                                    else
                                      {
                                        cc[j]=c[i];
                                         j++;
                                       }
                                 }
                                       System.out.print("After Removeing Vowels from a Sentence : ");
                                       System.out.print(cc);
               }
}

Remove Vowels from a Sentence





Subscribe To Free Daily Newsletter!

Get Free News Updates Delivered Directly To Your Inbox
About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to contact us.



What's New and Popular





Popular Article