title: Exceptions in c programming language
body: <p>I'm learning c language and I hit a wall, if you would like to help me I appreciate (here is the ex: "Write a program that reads characters from the standard input to end-of-file. For each character, have the program report whether it is a letter. If it is a letter, also report its numerical location in the alphabet and -1 otherwise." btw is not homework).The problem is with the \n i don't know how to make it an exception. I'm new around here please let me know if I omitted something. Thank you for your help.</p>
  
  <pre><code>int main(void)
  {
      char ch;
      int order;
  
      printf("Enter letters and it will tell you the location in the alphabet.\n");
      while ((ch = getchar()) != EOF)
      {
          printf("%c", ch);
          if (ch &gt;= 'A' &amp;&amp; ch &lt;= 'Z')
          {
              order = ch - 'A' + 1;
              printf(" %d \n", order);
          }
          if (ch &gt;= 'a'  &amp;&amp; ch &lt;= 'z')
          {
              order = ch - 'a' + 1;
              printf(" %d \n", order);
          }
          if (order != (ch &gt;= 'A' &amp;&amp; ch &lt;= 'Z') || (ch &gt;= 'a' &amp;&amp; ch &lt;= 'z'))
          {
              if (ch == '\n');
              else if (order != (ch &gt;= 'A' &amp;&amp; ch &lt;= 'Z') || (ch &gt;= 'a' &amp;&amp; ch &lt;= 'z'))
                  printf(" -1 \n");
          }
      }
  
      system("pause");
  }
  </code></pre>