a user entered an integer value into a text box. Without using a buit-in library, convert the numeric string to its integer representation.
static
int
StringTolnt(
string
s)
{
int sum = 0;
for (int i = 0; i < s.Length; i++)
sum = sum * 10 + (s[i] - '0');
return sum;
}
{
int sum = 0;
for (int i = 0; i < s.Length; i++)
sum = sum * 10 + (s[i] - '0');
return sum;
}