-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcountv.java
More file actions
28 lines (28 loc) · 796 Bytes
/
Copy pathcountv.java
File metadata and controls
28 lines (28 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.Scanner;
public class countv {
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
String s=sc.nextLine();
String vowel="aeiou";
String other="~!#$%^&*() 1234567890-=?<>;'\"";
int v=0,c=0,o=0;
for(int i=0;i<s.length();i++)
{
if(vowel.contains(s.charAt(i)+""))
{
v++;
}
else if(other.contains(s.charAt(i)+""))
{
o++;
}
else {
c++;
}
}
System.out.println("Number of Vowels :"+ v);
System.out.println("Number of Consonents: "+c);
System.out.println("Number of other Characters "+o);
}
}