user8646: Suppose I have a number with 2 digits, 42.
It is an integer, received from my RTC
Now for my 7 segment displays, I will need 2 separate numbers:

4 on display 1.
2 on display 2.

How do I slice this number in 2?

user6740: Numbers retrieved from an rtc are usually returned as a char or integer.
On this basis, you want
ones_column = bytefromrtc % 10;
tens_column = (bytefromrtc / 10) % 10;
hundreds_column = (bytefromrtc / 100) % 10;

the % operator returns the modulus - if you divide 42 by 10, the answer is 4, with a remainder of 2. % returns the remainder, in this example, 2.
To do the tens column, first get rid of the last digit by dividing by 10, then do the modulus as above. Since bytefromrtc is not a float, if you divide it, you lose the remainder - 42 / 10 = 4, not 4.2.
If the output is a word, or integer, or long integer, the method is exactly the same, except for the number of digits you can get out.

8646: <p>Suppose I have a number with 2 digits, 42.
It is an integer, received from my RTC</p>
<p>Now for my 7 segment displays, I will need 2 separate numbers:</p>
<ul>
<li>4 on display 1.</li>
<li>2 on display 2.</li>
</ul>
<p>How do I slice this number in 2?</p>
 6740: <p>Numbers retrieved from an rtc are usually returned as a char or integer.</p>

<p>On this basis, you want</p>

<pre><code>ones_column = bytefromrtc % 10;
tens_column = (bytefromrtc / 10) % 10;
hundreds_column = (bytefromrtc / 100) % 10;
</code></pre>

<p>the <code>%</code> operator returns the modulus - if you divide 42 by 10, the answer is 4, with a remainder of 2. % returns the remainder, in this example, 2.</p>

<p>To do the tens column, first get rid of the last digit by dividing by 10, then do the modulus as above. Since bytefromrtc is not a float, if you divide it, you lose the remainder - 42 / 10 = 4, not 4.2.</p>

<p>If the output is a word, or integer, or long integer, the method is exactly the same, except for the number of digits you can get out.</p>
