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); }
Mark as Answer if its helpful to you Kumaraspcode2009@gmail.com
Mark This Response as Answer -- Chandu http://www.dotnetfunda.com/images/dnfmvp.gif
string strWord = "chandrika"; // actual string // first get the lower case word and then replace each vowel wiyh empty space string resWord = ((((strWord.ToLower().Replace("a", "")).Replace("e","")).Replace("i","")).Replace("o","")).Replace("u",""); // find the length of result string and actual string then calculate difference int NumOfVowels = strWord.Length - resWord.Length;
Login to post response