Encode message by alphabets - Follow Up This code is a revised version of implementation which asked for a advice. Original question is here: Encode message by alphabets
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#define MIN_ALPH 1
#define MAX_ALPH 26

unsigned int my_decode(unsigned int input)
{
    unsigned int count = 0;
    unsigned int ddigit;
    int i;

    //check double digit decoding
    //TODO: make macro for (num &gt;= MIN_ALPH &amp;&amp; num &lt;= MAX_ALPH)
    if (input % 100 &gt;= MIN_ALPH &amp;&amp; input % 100 &lt;= MAX_ALPH)
        count++;

    if (input / 10 &gt;= MIN_ALPH &amp;&amp; input / 10 &lt;= MAX_ALPH)
    {
        if (input % 10 &gt; 0)
            count++;
    }

    //check single digit decoding
    for (i=1; i &lt;= 100; i*=10)
    {
        if (input % (i *10) / i == 0)
        break;
    }
    if (i == 1000)
        count++;

    return count;
}

int main(void)
{
    /*Given the mapping a = 1, b = 2, ... z = 26, and an encoded message,
    count the number of ways it can be decoded.
    For example, the message '111' would give 3,
    since it could be decoded as 'aaa', 'ka', and 'ak'.
    You can assume that the messages are decodable.
    For example, '001' is not allowed.*/

    printf(&quot;result: %u\n&quot;, my_decode(512));
    printf(&quot;result: %u\n&quot;, my_decode(542));
    printf(&quot;result: %u\n&quot;, my_decode(112));

}
Test clarity
A sample such as with my_decode(512) deserves a break down of how, as letters, it might be encoded.
Add as a comment, or integrate in test, the expected outputs.
Posting input as well as output is useful.
printf(&quot;%u --&gt; result: %u\n&quot;, 512, my_decode(512));

Format
Other code and below hints OP is not using an auto formatter as break is not indented.  1) Recommend to use an auto-formatter 2) Prefer { }
    if (input % (i *10) / i == 0)
    break;
    // vs.
    if (input % (i *10) / i == 0) {
        break;
    }

Macro vs. code
Consider a helper function
bool alph_in_range(unsigned num) {
  return num &gt;= MIN_ALPH &amp;&amp; num &lt;= MAX_ALPH;
}

Function
my_decode(102) is 2 and my_decode(1002) is 1.  I'd expect 2 for the first is allowed, 10,2 and 1,02 then 10,02 and 1,002 allowed for the 2nd.

Not much else to say.
Minor: _MAX
...._MAX more common in C such as INT_MAX
// #define MIN_ALPH 1
// #define MAX_ALPH 26

#define ALPH_MIN 1
#define ALPH_MAX 26

Minor: unsigned vs. unsigned int
Either works.  unsigned is shorter.
As with such style issues, code to your group's coding standard.
Minor: Mixed types
Some coding standards dislike  unsigned % int.
Could use input % 100u vs. input % 100.