For loop prints twie
<p>This is my code</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;math.h&gt;
#include &lt;string.h&gt;

int main()
{
int o;

int menu;
printf("\n\t\t\t\t _________________________________________\n");
printf("\t\t\t\t|                CONVERTER                |\n");
printf("\t\t\t\t|=========================================|\n");
printf("\t\t\t\t|         |                               |\n");
printf("\t\t\t\t|    1    |    Decimal    to     Binary   |\n");
printf("\t\t\t\t|_________|_______________________________|\n");
printf("\t\t\t\t|         |                               |\n");
printf("\t\t\t\t|    2    |    Binary     to     Decimal  |\n");
printf("\t\t\t\t|_________|_______________________________|\n");
printf("\t\t\t\t|         |                               |\n");
printf("\t\t\t\t|    3    |    Octal      to     Binary   |\n");
printf("\t\t\t\t|_________|_______________________________|\n");
printf("\t\t\t\t|         |                               |\n");
printf("\t\t\t\t|    4    |    Octal      to     Decimal  |\n");
printf("\t\t\t\t|_________|_______________________________|\n");
printf("\t\t\t\t|         |                               |\n");
printf("\t\t\t\t|    5    |    Decimal    to     Octal    |\n");
printf("\t\t\t\t|_________|_______________________________|\n");
printf("\t\t\t\t|         |                               |\n");
printf("\t\t\t\t|    6    |    Hexa       to     Decimal  |\n");
printf("\t\t\t\t|_________|_______________________________|\n");
printf("\t\t\t\t|         |                               |\n");
printf("\t\t\t\t|    0    |    Quit                       |\n");
printf("\t\t\t\t|_________|_______________________________|\n");
printf("\n");

for(o=1;o&lt;=50;o++){
printf("\n\t\t\t\t              Please select\n\n\t\t\t\t                    ");
menu = getchar();

    switch (menu)
    {
        case '1':{
            long int decimalNumber,quotient;
            int binaryNumber[100],i=1,j;
            printf("\n\t\t\t\tEnter any decimal number: ");
            scanf("%ld",&amp;decimalNumber);
            printf("\n");

            quotient = decimalNumber;


            while(quotient!=0){

                binaryNumber[i++]= quotient % 2;

                quotient = quotient / 2;}


printf("\t\t\t\tEquivalent binary value is: ");

for(j = i -1 ;j&gt; 0;j--){

     printf("%d",binaryNumber[j]);
}
printf("\n");
// o+= o + 1;
   }
            break;


        case '2':{
            long int binary1;
        printf("\n\t\t\t\tEnter any Binary Number:\n\n\t\t\t\t");
            scanf("%ld",&amp;binary1);
            printf("\n\t\t\t\tEquivalent binary value is: ");
            int decimal=0;
            int i=0;
            int rem;
            while(binary1!=0)
            {
                rem = binary1%10;
                binary1/=10;
                decimal += rem*pow(2,i);
                ++i;
            }

            printf("\n\n\t\t\t\t%d\n", decimal);
        }
            break;


        case '3':{
            long int octal1;
printf("\n\t\t\t\tEnter any Octal number: ");
scanf("%ld", &amp;octal1);
int decimal=0, binary=0, i=0;
printf("\n\t\t\t\tThe Equivalent Binary Value is: ");
while(octal1!=0)
{
    decimal+=(octal1%10)*pow(8,i);
    ++i;
    octal1/=10;
}
i=1;
while(decimal!=0)
{
    binary+=(decimal%2)*i;
    decimal/=2;
    i*=10;
}
printf("%d\n", binary);
        }
            break;


        case '4':{
                      long int octal2;
printf("\n\t\t\t\tEnter any Octal number: ");
scanf("%ld", &amp;octal2);
int decimal2=0, i=0;
printf("\n\t\t\t\tThe Equivalent Decimal Value is: ");
while(octal2!=0)
{
    decimal2+=(octal2%10)*pow(8,i);
    ++i;
    octal2/=10;
}
        printf("%d\n", decimal2);
       }
            break;


        case '5':{
       long int decimal2,quotient2;
      printf("\n\t\t\t\tEnter any decimal number: ");

        scanf("%ld",&amp;decimal2);
        int octal3[100],w=1,e;

        quotient2 = decimal2;
        while(quotient2!=0){


        octal3[w++]= quotient2%8;

        quotient2 = quotient2 / 8;

}
        printf("\n\t\t\t\tEquivalent octal value is: ");
        for(e=w-1;e&gt;0;e--)
        printf("%d", octal3[e]);
        printf("\n");

        }
            break;


        case '6':{
            unsigned int q;
            printf("\n\t\t\t\tEnter any Hexadecimal number: ");
            scanf("%x", &amp;q);
            printf("\nThe Equivalent decimal value is: ");
            printf("%d\n", q);
        }
            break;


        case '0':{

            printf("\n\t\t\t\t              Are you sure?\n\n\t\t\t\t              y or n: ");
            char b[9];
            scanf("%s", b);
            if(strcmp(b,"y")==0){
            o=o+50;
            printf("\n\n\t\t\t\t              Have a nice day!\n\n");}

            }

            break;

    }



    }


    return 0;

}
</code></pre>

<p>After getting the result for an item in the menu, the "Please select" phrase prints 2 times before letting you select another menu item. </p>

<p>Why is it printing 2 times?</p>

<p>This is a converter program as a project for my basic programming subject. We were told to make a program that converts these numbers, and after converting a number, the program should not end and should let you select another option or select the "quit" for exiting the program.</p>