title: Unhandled Exception: System.FormatException
body: <p>I'm having a trouble trying to fix a simple c# code. Here's the code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace MoonGravity
  {
      class MoonGravity
      {
          static void Main(string[] args)
          {
              int number = Convert.ToInt32(Console.ReadLine());
              float gravity = (number * 0.17f);
              Console.WriteLine(gravity.ToString("F3"));
          }
      }
  }
  </code></pre>
  
  <p>I need it to output a single floating-point value and all values must be with exactly 3-digit precision after the floating point. I got it to work, the only problem is that it crashes if I don't input a whole number. That's the error i get.</p>
  
  <blockquote>
    <p>Unhandled Exception: System.FormatException: Input string was not in a correct format.
       at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer&amp; number, NumberFormatInfo info, Boolean parseDecimal)
       at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
       at System.Convert.ToInt32(String value)
       at MoonGravity.MoonGravity.Main(String[] args) in .... 2015\Projects\ConsoleApplication3\ConsoleApplication3\Program.cs:line 13</p>
  </blockquote>
  
  <p>I know the problem comes from my <code>Convert.ToInt32</code> and I tried to fix it but i couldn't. Thank you for the help.</p>