static void Main(string[] args)
{
int num = 382;
int output = 0;
char[] nlst = num.ToString().ToCharArray();
for (int i = 0; i < nlst.Length; i++)
{
output += nlst[i];
}
Console.WriteLine(output);
Console.ReadLine();
}
The output result is 157, Actually it should be 13.With Dedbugging I found the 3 elements of char[] nlst like this :
[0]51'3', [1]56'8', [2]50'2'
Why? What's the meaning of 51,56,50?