C# - Seperate integers/strings with division and remainder
<p>was referred to this site from a friend of mine, I hope to stay here long =)</p>

<p>I have a homework that I just can't figure out how to do. I'm not sure if the teacher wrote it wrong(he is a bad typer) or if there is a way to accomplish the task.</p>

<p>I work in Visual C# 2010 Express - Console Application</p>

<h2>My task is to:</h2>

<p>Read a four digit integer, such as 5893, from the keyboard and display the digits separated from one another by a tab each. Use both integer division and modulus operator % to pick off each digit. If the user enters 4567, the output looks like:</p>

<p>4567</p>

<p>4    5    6    7</p>

<p>Sure I know how to seperate the numbers by using \t aswell as reading the input and displaying it to the user. But how am I supposed to 'pick off' each digit with division and the remainder operators??? Maybe he means something else, but not sure. Have to ask him if noone here knows a solution... hehe</p>

<h2>And another question...</h2>

<p>How do a make sure that what the user types in is a number and not a letter?
Do i have to use "Char.IsLetter", because I couldn't figure out how to use it on a parsed string.</p>

<p>example:</p>

<pre><code>        string number1;
        int x;
        Console.Write("Please enter a number to calculate: ");
        number1 = Console.ReadLine();
        x = Int32.Parse(number1);
</code></pre>

<p>What method am I supposed to use and where do i put it in? Beacause now i only get an error and the application shuts down if I try to enter e letter....</p>

<p>Thanks in advance!</p>

<p>/Anthony</p>

<p>P.S. I'm very new to C# programming, though I do understand logic...</p>
