C code to find "Cullen's number" : <p>Need to make a C code that asks of the user to input one number, and the code will check whether the number is a "Cullen's number" or not.</p>

<p>A number is Cullen's number as long as you can calculate it by doing "2^n * n + 1".</p>

<p>Examples of Cullen's numbers:</p>

<pre><code>3=2^1 * 1 + 1
9=2^2 * 2 + 1
25=2^3 * 3 + 1
</code></pre>

<p>Here's the code I was working on, any help?</p>

<pre><code>#define _CRT_SECURE_NO_WARNINGS
#include &lt;stdio.h&gt;

int main(void)

{

    int num, brojP, potency = 0, numRepeats = 0, endResult=0, isCullen;

    printf("Unesite broj");
    scanf("%d", &amp;num);

    do
    {

        potency = potency + 1; // initializing "potency" and at the same time making it one number larger at each repeat of the loop
        do
        {
            brojP = 2*potency;
            numRepeats = numRepeats + 1;
        } while (numRepeats &lt; potency); // this entire loop is used for "2^n" part

        endResult = brojP * potency + 1; // calculate the "2^n * n + 1" 
        numRepeats = 0;

        if (endResult == num)
        {
            isCullen = 1;
            break;
        }


    } while (endResult &lt; num);

    if (isCullen == 1)
        printf("Number inputted is Cullen's number\n");
    else
        printf("Number inputted isn't Cullen't number\n");

    return 0;


}
</code></pre>
