package com.pack.string;
import java.util.Scanner;
public class Vowel {
public static void main(String[] args) {
String str;
int vowel=0;
int conso=0;
int space=0;
System.out.println("Ener the string");
Scanner sc=new Scanner(System.in);
str=sc.nextLine();
char arr[]=new char[str.length()];
arr=str.toCharArray();
for(char ch:arr)
{
switch(ch)
{
case 'a':
case 'A':
case 'E':
case 'e':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
vowel++;
break;
case ' ':
space++;
break;
default:
conso++;
}
}
System.out.println("Vowel= "+vowel);
System.out.println("Consonent= "+conso);
System.out.println("Space= "+space);
System.out.println("total= "+(vowel+(conso+space)));
}
}
import java.util.Scanner;
public class Vowel {
public static void main(String[] args) {
String str;
int vowel=0;
int conso=0;
int space=0;
System.out.println("Ener the string");
Scanner sc=new Scanner(System.in);
str=sc.nextLine();
char arr[]=new char[str.length()];
arr=str.toCharArray();
for(char ch:arr)
{
switch(ch)
{
case 'a':
case 'A':
case 'E':
case 'e':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
vowel++;
break;
case ' ':
space++;
break;
default:
conso++;
}
}
System.out.println("Vowel= "+vowel);
System.out.println("Consonent= "+conso);
System.out.println("Space= "+space);
System.out.println("total= "+(vowel+(conso+space)));
}
}
0 comments:
Post a Comment