I'm having trouble converting a string to a integer, my program is failing on this line
int newS = int.Parse(s);
With message:
An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
The number I'm expecting back from my program is rather large. Below is the total program:
int math = (int)Math.Pow(2,1000);
string mathString = math.ToString();
List<string> list = new List<string>();
char[] ch = mathString.ToCharArray();
int result = 0;
foreach (char c in mathString)
{
string newC = c.ToString();
list.Add(newC);
//Console.WriteLine(newC);
}
foreach (string s in list)
{
int newS = int.Parse(s);
result += newS;
}
Console.Write(result);
Console.ReadLine();