Q:

alculate The Vowels In The Given String Using Java

0

This Program is used to calculate the vowels in the Given String using Java

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

// Vowels program 

import java.io.*; 
import java.lang.String.*; 
import java.text.*; 

class ssva26 
{ 
public static void main(String arg[]) throws IOException 
{ 
String str; 
char s; 
int ch=0,l; 
BufferedReader inp = new BufferedReader(new InputStreamReader(System.in)); 
System.out.println("\n\t\t\t\tCount the Vowels"); 
System.out.println("\n\t\t\t\t~~~~~~~~~~~~~~~~"); 
System.out.print("\nEnter the String: "); 
str = inp.readLine(); 
l=str.length(); 
for(int i=0;i<l;i++) 
{ 
s=str.charAt(i); 
if( (s=='a') || (s=='e') || (s=='i') || (s=='o') || (s=='u') ) 
ch++; 
} 
System.out.println("\nNumber of vowels: " + ch); 
} 
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now