check weather a given character is upper or lower or neither -cp-training

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main() {
char ch;
    scanf("%c",&ch);
    if(ch>='A' && ch<='Z')
        printf("%c is uppercase letter",ch);
    else if (ch>='a' && ch<='z')
        printf("%c is lowercase letter",ch);
    else
       printf("%c is neither an uppercase or lowercase letter",ch);
    return 0;
}

No comments:

Post a Comment