string r; r = Console.ReadLine(); int count = 0; char[] vow = new char[] { 'a', 'e', 'i', 'o', 'u' }; string res = new string(vow); for (int x = 0; x < r.Length; x++) { if (res.Contains(r[x])) { count++; } Console.Write("vowel count:{0}", count); break; }
for (int x = 0; x < r.Length; x++) { if (vow.Contains(r[x])) { count++; } } Console.Write("vowel count:{0}", count);
// required using Linq; string r = Console.ReadLine(); int count = r.Count(ch => "aeiou".Contains(ch)); Console.WriteLine("vowel count:{0}", count);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)