Mega Code Archive

 
Categories / C Tutorial / Statement
 

Use compound conditions to check for upper and lowercase letters

#include <stdio.h> main(){     char cResponse = '\0';     printf("Enter the letter A: ");     scanf("%c", &cResponse);     if ( cResponse== 'A' || cResponse == 'a' )        printf("\nCorrect response\n");     else        printf("\nIncorrect response\n"); } Enter the letter A: 1 Incorrect response