Use switch with number case and char case
<p>I want to make a <code>switch</code> loop. </p>

<p>If input is from <code>1</code> to <code>5</code>. It will print a number. Else it will print <code>"this is not a number"</code>. And if the input is <code>'e'</code>. The <code>switch</code> loop should be ended. </p>

<p>I can make the number part, but I don't know how can I to make input with <code>'e'</code>. It just won't read. Here is my code:</p>

<pre><code>int main() {
int i,a = 0;
printf("Write something:");
scanf("%d", &amp;i);
    do{
    switch (i)
    {
    case 1:
        printf("1");
        break;
    case 2:
        printf("2");
        break;
    case 3:
        printf("3");
        break;
    case 4:
        printf("4");
        break;
    case 5:
        printf("5");
        break;
    case 'e':
        a=1;
        break;
    default:
        printf("This is not a number”); 
        break;
    }
}while (a==0);}
</code></pre>

<p>My problem is I can't have input as <code>'e'</code> or any char. Because if I do that I will create a paradox loop or just don't work at all. Where am I wrong?</p>