Back to: Java Program’s
public class Question5_2005 { static void main() { Scanner sc=new Scanner(System.in); System.out.println("Enter a word :"); String s=sc.next(); int cont=0; int numb=s.length(); String low=s.toLowerCase(); String nr=""; int spe=0; for(int i=0;i<s.length();i++) { char ch=low.charAt(i); if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u') { cont=cont +1; } else if(ch>=33&&ch<=47||ch==64) { spe=spe+1; } } for(int r=s.length()-1;r>=0;r--) { char ch2=s.charAt(r); nr=nr+ch2; } System.out.println("Total number of characters :"+numb); System.out.println("Total number of vowels :"+cont); System.out.println("Reverse order :"+nr); System.out.println("Total number of consonants:"+(s.length()-(cont+spe))); System.out.println("Total number of special characters :"+spe); } }
Submitted By: Ms. Suchetana Mukherjee
If this program was helpful to you, do leave a comment.
All Creadit goes to Ms. Suchetana Mukherjee
P.N. : All the post on this website are for demonstration and education purpose only.
Student should perform all the practicals for there personal copies.