Hi. I am trying to convert a user input string to an int but getting this error.
Unhandled exception. System.FormatException: Input string was not in a correct format. at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type) at System.Convert.ToInt32(String value) at csharpfundamentals.Practice.Main(String[] args)
// Code snippet
Console.WriteLine("Enter a number: ");
string user_input = Console.ReadLine();
int number = Convert.ToInt32(user_input);