Code for finding the no. of times a character is repeated?

Kmandapalli
Posted by Kmandapalli under C# category on | Points: 40 | Views : 506
static void Main(string[] args)
{
string s = "Welcometodotnetfunda":
char[] c = s.ToCharArray();
int count = 0;
foreach (char ch in c)
{
if (ch == 'o')
count++;
}
Console.WriteLine("No of times o is repeated :" + count);
Console.ReadKey();
}

Comments or Responses

Login to post response