Search This Blog

UI/UX Design | Web Development | Mobile Application Development

Whether you need UI/ UX design, web development services, or mobile app development services, Qaabil Digitals will be more than happy to help you. We work with top software developers, designers, and project managers. We tailor our services to suit your exact needs. We closely look at your company, listen to your story, and bring about the best ideas and solutions that can help you drive solid results. We don’t just produce work that works. We produce work that matters. Get a quote now Or Talk to us

Saturday, 5 November 2011

Write a program that store (a, e, i, o and u) in string data type. Then ask the user to enter a string of characters. then the program should count the number of vowels in that string (by Tieqa)


import java.util.*;
class charvowels
{
public static void main (String args[])
{
Scanner in = new Scanner (System.in);
char vowels[] = new char[10];
String str;
char c1,c2;
int t=0;

vowels[0] = 'A';
vowels[1] = 'a';
vowels[2] = 'E';
vowels[3] = 'e';
vowels[4] = 'I';
vowels[5] = 'i';
vowels[6] = 'O';
vowels[7] = 'o';
vowels[8] = 'U';
vowels[9] = 'u';

System.out.print ("\n\t Enter the string = ");
str=in.nextLine();

System.out.print ("\n\n\t Vowels in the string = ");
for (int i=0;i<str.length();++i)
{
c1=str.charAt(i);
for (int j=0;j<10;++j)
{
if (c1==vowels[j])
{
System.out.print (" "+c1);
++t;
break;
}
}
}

System.out.println ("\n\t Total number of vowels = "+t);
}
}

2 comments:

  1. I haven’t cheсkеd in hеre for а while since I thought it wаs gеttіng borіng, but
    the last ѕеveral pοsts aгe greаt quality so I guess I will adԁ you bаck to my everydaу bloglist.
    Υou dеserve it fгiend :)
    Here is my site : augen op kosten

    ReplyDelete
  2. Hi, ϳust wanted to tell you, I lоvеd this aгticle.

    It was funny. Keep on роsting!
    Look at my web page : laptops special

    ReplyDelete

Share