private static string getXCharInt(int i_numOfDigits) { Console.WriteLine("Please type a 9 digits number"); string inputStr = Console.ReadLine(); while (inputStr.Length != 9 || !Ex4Proj.IsLanguageByAsciiCodesBounds(inputStr, '0', '9')) { Console.WriteLine("Invalid input, Please type again"); inputStr = Console.ReadLine(); } return(inputStr); }
private static int countDigitsDividedByNum(string i_numToDivideStr, int i_numToDivideIn) { int dividedByNumCounter = 0; while (i_numToDivideStr.Length > 0) { if (Ex4Proj.IsDevidedByNum((i_numToDivideStr[0] - '0'), i_numToDivideIn)) { dividedByNumCounter++; } i_numToDivideStr = i_numToDivideStr.Substring(1, i_numToDivideStr.Length - 1); } return(dividedByNumCounter); }
public static void Main() { int numOfStars; Console.WriteLine("Please enter the number of stars for the base and the seal :"); string inputNumOfStars = Console.ReadLine(); while (!Ex4Proj.IsLanguageByAsciiCodesBounds(inputNumOfStars, '0', '9')) { Console.WriteLine("invalid number, Please enter the number of stars for the base and the seal :"); inputNumOfStars = Console.ReadLine(); } numOfStars = int.Parse(inputNumOfStars); if (numOfStars % 2 == 0) { numOfStars++; } Ex2Proj.PrintSandTimer(numOfStars, 0); }