How to know how many vowels are present in a word with Separete Count.

Jayakumars
Posted by Jayakumars under ASP.NET AJAX category on | Points: 40 | Views : 2133
protected void btClick_Click(object sender, EventArgs e)
{
string Txtw1 = "";
Txtw1= Txtw.Text.ToUpper();
int count = 0;
foreach (char c in Txtw1)
{

if (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U')
{
count = count + 1;
if (c == 'A') { countA = countA + 1; StrAcnt = c + " " + countA.ToString(); }
if (c == 'E') { countE = countE + 1; StrEcnt = c + " " + countE.ToString(); }
if (c == 'I') { countI = countI + 1; StrIcnt = c + " " + countI.ToString(); }
if (c == 'O') { countO = countO + 1; StrOcnt = c + " " + countO.ToString(); }
if (c == 'U') { countU = countU + 1; StrUcnt = c + " " + countU.ToString(); }
}
}
Response.Write(StrAcnt + " " + StrEcnt + " " + StrIcnt + " " + StrOcnt + " " + StrUcnt);
}

Comments or Responses

Login to post response