Testing letters using and : Operator Relation « Language Basics « C / ANSI-C






Testing letters using and

/*Testing letters using and */
#include <stdio.h>
void main()
{
   char letter =0;                         /* Stores an input character */
   
   printf("Enter an upper case letter:");   
   scanf(" %c", &letter);                  /* Read the input character  */

   if ((letter >= 'A') && (letter <= 'Z')) /* Verify uppercase letter  */
   {
     letter += 'a'-'A';                    /* Convert to lowercase     */
     printf("Your enter is %c.\n", letter);
   }
   else
     printf("An uppercase letter please.\n");
}



           
       








Related examples in the same category

1.Logical operator
2.Relational and logical operationsRelational and logical operations