public static void Main()
string str = " Blooddonars is a service oriented web application where automation of finding donor for a blood seeker ";
Console.Write(GetWordCount(str));
public static int GetWordCount(string text)
int wordCount = 0, index = 0;
while (index < text.Length && char.IsWhiteSpace(text[index]))
while (index < text.Length)
while (index < text.Length && !char.IsWhiteSpace(text[index]))
while (index < text.Length && char.IsWhiteSpace(text[index]))