/* JAVA PROGRAM TO COUNT
NUMBER OF VOWELS IN GIVEN STRING */
class VowelsCount{
public static void main(String[] args){
int i=0,c=0;
String s1=new String("asia's largest institution is not in hyderabad");
char ch;
for(i=0;i<s1.length();i++){
ch=(s1.charAt(i));
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'){
c++;
}
}
System.out.println("the total number of vowels in a string"+c);
}
}
NUMBER OF VOWELS IN GIVEN STRING */
class VowelsCount{
public static void main(String[] args){
int i=0,c=0;
String s1=new String("asia's largest institution is not in hyderabad");
char ch;
for(i=0;i<s1.length();i++){
ch=(s1.charAt(i));
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'){
c++;
}
}
System.out.println("the total number of vowels in a string"+c);
}
}
No comments:
Post a Comment