title: C switch "default" not working in desired way
body: <p>I am still learning programming, so sorry if there is a simple question. I have a program here that determines if a number is divisible by 23. However, if someone enters a character (which might happen on accident), such as "u," it incorrectly shows that it is indeed divisible by 23. How can I modify this program so that it displays that as an error?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void)
  {
      double enterednumber;
  
      printf("This is a test to see if a number is divisible by 23.\nPlease enter a number ");
      scanf("%lg", &amp;enterednumber);
  
      switch ((int) enterednumber%23)
      {
          case 0:
              printf("Yes, %g is divisible by 23\n", enterednumber);
              break;
          default:
              printf("No, %g is not divisible by 23\n", enterednumber);
              break;
      }
  
      return 0;
  }
  </code></pre>