Java program to count the number of vowels in a String
Login/Signup to comment
14 comments on “Java program to count the number of vowels in a String”
×
30+ Companies are Hiring
Get Hiring Updates right in your inbox from PrepInsta
Login/Signup to comment
Get Hiring Updates right in your inbox from PrepInsta
public class Noofvowels {
public static void main(String arg[]) {
String s = “Lalit”;
int count = 0;
for(int i=0;i<s.length();i++) {
char c= s.charAt(i);
c=Character.toUpperCase(c);
if(c=='A'||c=='E'||c=='I'||c=='O'||c=='U') {
count++;
}
}
System.out.println(count);
}
}
Hey there, Thanks for commenting, kindly join our Discord server, our mentors will guide you further precisely will all your queries.🙌