using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _04.NthDigit { class NthDigit { static void Main() { Console.Write("Enter a number: "); string number = Console.ReadLine(); Console.Write("Enter a position to check: "); int position = int.Parse(Console.ReadLine()); if (position > 0 && position <= number.Length) { int enteredNum = Convert.ToInt32(number); double nDigit = (enteredNum / Math.Pow(10, (position - 1))) % 10; Console.WriteLine((int)nDigit); } else { Console.WriteLine("-"); } } } }