title: Exeption Unhandled : System.FormatException: 'Input string was not in a correct format
body: <p>I'm new to c# and i keep getting this error: Exception Unhandled: System.FormatException: 'Input string was not in a correct format. Idk why I'm trying to make a calculator, it happens while multiplying. I think its because of changing the data type from int to string, idk what is happening someone pls help. Here is the code:</p>
  <pre><code>            if (command == &quot;help&quot;) //for help
              {
                  Console.WriteLine(&quot;:p&quot;);
                  command = Console.ReadLine();
              }
              else
              {
                  if (command == &quot;add&quot;)
                  {
                      Console.WriteLine(&quot;First Number: &quot;);
                      string a = Console.ReadLine();
                      Console.WriteLine(&quot;Second Number: &quot;);
                      string b = Console.ReadLine();
                      Console.WriteLine(&quot;third Number: &quot;);
                      string c = Console.ReadLine();
                      if (c != &quot;done&quot;)
                      {
                          Console.WriteLine(&quot;Fourth Number: &quot;);
                          string d = Console.ReadLine();
                          if (d != &quot;done&quot;)
                          {
                              Console.WriteLine(&quot;Fifth Number: &quot;);
                              string e = Console.ReadLine();
                              if (e != &quot;done&quot;)
                              {
                                  Console.WriteLine(&quot;Sixth Number: &quot;);
                                  string f = Console.ReadLine();
                                  if (f != &quot;done&quot;)
                                  {
                                      Console.WriteLine(&quot;Seventh Number: &quot;);
                                      string g = Console.ReadLine();
                                      if (g != &quot;done&quot;)
                                      {
                                          Console.WriteLine(&quot;Eighth Number: &quot;);
                                          string h = Console.ReadLine();
                                          if (h != &quot;done&quot;)
                                          {
                                              Console.WriteLine(&quot;Ninth Number: &quot;);
                                              string i = Console.ReadLine();
                                              Console.WriteLine(a + b + c + d + e + f + g + h + i);
                                          }
                                          
                                      }
                                      
                                  }
                                  
                              }
                              
                          }
                         
                      }
                      command = Console.ReadLine();
                  }
                  else
                  {
                      if(command == &quot;sub&quot;) //for subtraction
                      {
                          Console.WriteLine(&quot;First Number: &quot;);
                          int a = Convert.ToInt32(Console.ReadLine());
                          Console.WriteLine(&quot;Second Number: &quot;);
                          int b = Convert.ToInt32(Console.ReadLine());
                          int c = Convert.ToInt32(Console.ReadLine());
                          if (c != Convert.ToInt32(&quot;done&quot;))
                          {
                              int d = Convert.ToInt32(Console.ReadLine());
                              if (d != Convert.ToInt32(&quot;done&quot;))
                              {
                                  int e = Convert.ToInt32(Console.ReadLine());
                                  if (e != Convert.ToInt32(&quot;done&quot;))
                                  {
                                      int f = Convert.ToInt32(Console.ReadLine());
                                      if (f != Convert.ToInt32(&quot;done&quot;))
                                      {
                                          int g = Convert.ToInt32(Console.ReadLine());
                                          if (g != Convert.ToInt32(&quot;done&quot;))
                                          {
                                              int h = Convert.ToInt32(Console.ReadLine());
                                              if (h != Convert.ToInt32(&quot;done&quot;))
                                              {
                                                  int i = Convert.ToInt32(Console.ReadLine());
                                                  Console.WriteLine(a - b - c - d - e - f - g - h - i);
  
                                              }
                                          }
  
                                      }
                                  }
                              }
  
                          }
                          command = Console.ReadLine();
                      }
                      else
                      {
                          if (command == &quot;mod&quot;) //for Modulus
                          {
                              Console.WriteLine(&quot;First Number: &quot;);
                              int a = Convert.ToInt32(Console.ReadLine());
                              Console.WriteLine(&quot;Second Number: &quot;);
                              int b = Convert.ToInt32(Console.ReadLine());
                              Console.WriteLine(a % b);
                              command = Console.ReadLine();
                          }
                          else
                          {
                              if(command == &quot;div&quot;) //for division
                              {
                                  Console.WriteLine(&quot;First Number: &quot;);
                                  int a = Convert.ToInt32(Console.ReadLine());
                                  Console.WriteLine(&quot;Second Number: &quot;);
                                  int b = Convert.ToInt32(Console.ReadLine());
                                  Console.WriteLine(a / b);
                                  command = Console.ReadLine();
                              }
                              else
                              {
                                  if (command == &quot;multi&quot;) //for Multiplication
                                  {
                                      Console.WriteLine(&quot;First Number: &quot;);
                                      int a = Convert.ToInt32(Console.ReadLine());
                                      Console.WriteLine(&quot;Second Number: &quot;);
                                      int b = Convert.ToInt32(Console.ReadLine());
                                      int c = Convert.ToInt32(Console.ReadLine());
                                      if (c != Convert.ToInt32(&quot;done&quot;))
                                      {
                                          int d = Convert.ToInt32(Console.ReadLine());
                                          if (d != Convert.ToInt32(&quot;done&quot;))
                                          {
                                              int e = Convert.ToInt32(Console.ReadLine());
                                              if ( e!= Convert.ToInt32(&quot;done&quot;))
                                              {
                                                  int f = Convert.ToInt32(Console.ReadLine());
                                                  if (f != Convert.ToInt32(&quot;done&quot;))
                                                  {
                                                      int g = Convert.ToInt32(Console.ReadLine());
                                                      if (g != Convert.ToInt32(&quot;done&quot;))
                                                      {
                                                          int h = Convert.ToInt32(Console.ReadLine());
                                                          if (h != Convert.ToInt32(&quot;done&quot;))
                                                          {
                                                              int i = Convert.ToInt32(Console.ReadLine());
                                                              Console.WriteLine(a * b * c * d * e * f * g * h * i);
  
                                                          }
                                                      }
  
                                                  }
                                              }
                                          }
  
                                      }
  
                                      command = Console.ReadLine();
                                  }
                              }
  
                          }
                      }
                  }
  
                  
              }
  
          } while (command != &quot;exit&quot;);
      }
  }
  </code></pre>
  <p>}</p>