0
Please check my work.
2 Answers
+ 1
If you have problem with code then save code in playground and share code link here.. That helps to find where is mistake.. But with this code snippet, not able to find how you are running code.. I can only find that there you are not using proper braces {} for while block..
For further any correction if you need share complete code link.. Hope it helps...
Edit :
https://www.sololearn.com/post/75089/?ref=app
0
string str;
int alp, digit, splch, i,l;
alp = digit = splch = i = 0;
Console.Write("Input the string : Welcome to w3resource.com");
str = Console.ReadLine();
l=str.Length;
while(i<l)
if((str[i]>='a' && str[i]<='z') || (str[i]>='A' && str[i]<='Z'))
alp++;
else if(str[i]>='0' && str[i]<='9')
digit++;
else
splch++;
i++;
Console.Write("Number of Alphabets in the string is : {0}\n",alp++);
Console.Write("Number of Digits in the string is : {0}\n", digit++);
Console.Write("Number of Special characters in the string is : {0}\n\n", ++splch);