Friday, 24 October 2014

Program to find the total numbers of characters vowels and reverse of string.

/* Program to find the total numbers of characters vowels and reverse of string */

import java.io.*;
public class count_reverse
{
    public static void main(String args[])throws IOException
    {
        InputStreamReader read= new InputStreamReader(System.in);
        BufferedReader in =new BufferedReader(read);
        String st,uc,rev=" ";
        int len,i,count=0;
        char ch;
        System.out.println("Enter String:");
        st=in.readLine();
        uc=st.toUpperCase();
        len=st.length();
        for(i=0;i<len;i++)
        {
            ch=uc.charAt(i);
            if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U')
            count++;
        }
        for(i=len-1;i>=0;i--)
        {
            ch=uc.charAt(i);
            rev=rev+ch;
        }
        System.out.println("Total number of characters:"+len);
        System.out.println("Numbers of vowels:"+count);
        System.out.println("Reverse of String:"+rev);
    }
}
       

     
 

 

No comments:

Post a Comment