Write a program to input a set of 20 letters. Convert each letter into upper case. Find and display the number of vowels and number of consonants present in the set of given letters
Answers
Answered by
8
Answer:import java.util.*;
public class Word
{
public static void main (String args[])
{
Scanner sc=new Scanner (System.in);
char ch[]=new char[20];
int i,vowelcount=0,consonantcount=0;
for(i=0;i<20;i++)
{
System.out.println("Enter the character");
ch[i]=sc.next().charAt(0);
}
for(i=0;i<20;i++)
{
ch[i]=Character.toUpperCase(ch[i]);
}
for(i=0;i<20;i++)
{
if(ch[i]=='A'||ch[i]=='E'||ch[i]=='I'||ch[i]=='O'||ch[i]=='U')
vowelcount++;
else
consonantcount++;
}
for(i=0;i<20;i++)
{
System.out.println(vowelcount);
System.out.println(consonantcount);
}
}
}
Explanation:
Similar questions
Math,
3 months ago
Science,
3 months ago
India Languages,
3 months ago
Math,
7 months ago
Chemistry,
11 months ago
Social Sciences,
11 months ago