vowel counting edited by diya
import java.util.Scanner;
class p19
{
public static void main(String args[])
{
Scanner n=new Scanner(System.in);
int v=0;
System.out.println("enter a string");
String s=n.nextLine();
for(int i=0;i<s.length();i++)
{
char ch=s.charAt(i);
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
{
v++;
}
}
System.out.println("total vowel="+v);
}
}
D:\>java p19
enter a string
kolkata
total vowel=3
D:\>
No comments:
Post a Comment