سلام دوستان در این تاپیک ، کد شمارش تعداد حروف در یک کلمه در سی شارپ رو براتون آماده کردم.
کد شمارش تعداد حروف در یک کلمه در سی شارپ :
class Program
{
static void Main(string[] args)
{
String s = "program98 website";
while (s.Length > 0)
{
Console.Write(s[0] + ":");
int count = 0;
for (int i = 0; i < s.Length; i++)
{
if (s[0] == s[i])
{
count++;
}
}
Console.WriteLine(count);
s = s.Replace(s[0].ToString(), string.Empty);
}
Console.Read();
}
}
{
static void Main(string[] args)
{
String s = "program98 website";
while (s.Length > 0)
{
Console.Write(s[0] + ":");
int count = 0;
for (int i = 0; i < s.Length; i++)
{
if (s[0] == s[i])
{
count++;
}
}
Console.WriteLine(count);
s = s.Replace(s[0].ToString(), string.Empty);
}
Console.Read();
}
}
پیروز و سربلند باشید