Wednesday 27 January 2016

write a program in java to print only vowels present in a sentence without using build in function.

Code:
class Vowel_ASCII
{
  public static void main(String args[])
  {
    String st="THIS IS IT COMPUTER";
    int i,l,c,count=0;
    l=st.length();
    for(i=0;i<l;i++)
    {
      c=st.charAt(i);
      if(c==65 || c==69 || c==73 || c==79 || c==85 ||
         c==97 || c==101 || c==105 || c==111 || c==117)
         System.out.print((char)c+" ");
     }
  }
}

No comments:

Post a Comment