getchar() doesn't work in C
<p>I'm using <code>getchar()</code> to get a word in C and use switch to know what was the input, but it doesn't wait for input. Can anybody tell me why that is?</p>

<p>and this is my code:<br></p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;math.h&gt;
int main()
{
    printf("Written By A.Rahbari\n");
    float velocity_ratio_of_sun_and_planet ;
    float velocity_ratio_double_gear;
    float N_Annulus;
    float N_Sun;
    float N_Planet;
    float u;
    int x;
    int y;
    int i;
    int g;
    printf("Enter velocity ratio of sun and planet:\n");
    scanf("%f",&amp;velocity_ratio_of_sun_and_planet);
    printf("Enter velocity ratio of double gear:\n");
    scanf("%f",&amp;velocity_ratio_double_gear);
    printf("Enter sun or annulus:");
    g=getchar();
    switch(g)
    {

    case '10' :
        printf("your design is based on annulus\n");
        printf("Enter range of annulus teeth per inch:\n");
        scanf("%d%d",&amp;x,&amp;y);
        printf("Enter nember of range step:\n");
        scanf("%d",&amp;i);
        for (N_Annulus=x; N_Annulus&lt;=y; N_Annulus+=i)
        {
            N_Sun = N_Annulus / (velocity_ratio_of_sun_and_planet - 1);
            N_Planet=( N_Annulus - N_Sun )/2;
            u=(N_Sun - floor(fabs(N_Sun)))+(N_Planet - floor(fabs(N_Planet)));
            printf("g");
            if (u == 0)
            {
                printf("\t%d\t\t   %d\t\t %d\t\t\n",N_Annulus,N_Sun,N_Planet);
            }
            else
            {
                continue;
            }
         }
         break;

    case 's':

        break;
    }

    return 0;
}
</code></pre>