using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
String str = "hello am here now ooo";
countVowels(str);
}
public static void countVowels(String st)
{
int vowelct=0;
foreach(char ch in st.ToLower())
{
if((ch>='A' && ch<='Z')||(ch>='a' && ch<='z'))
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
vowelct++;
if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U')
vowelct++;
}
Console.Write("Vowels count " + vowelct);
}
}
}
|