I am trying to limit the input of the console in order to add an error message on invalid input. The input must be 9 numbers (Edit : In a range of 100000000 - 999999999) for it to be valid. The problem I am running into is getting the error to display properly as well as getting the program to continue to function. The program is set up to work with sin as an integer.
int sin;
Console.Write("Please enter sin number: ");
sin = int.Parse(Console.ReadLine());
I tried using this below but got endless error messages as well as invalid input on all inputs
var digits = Console.ReadLine();
while (digits.Length > 9 || digits.Length < 9)
{
Console.WriteLine("Error invalid entry");
}
How do I get the program to check the length of the digits as well as continue the program with sin as an int value so the rest of the program can work properly?