zzulioj 1026: Character type judgment

Title description
Input a character from the keyboard to determine whether the character is an uppercase letter, lowercase letter, numeric character or other characters. Output the corresponding prompt information respectively.
Enter
Enter a character.
Output
If the character is an uppercase letter, output "upper"; if it is a lowercase letter, output "lower"; if it is a numeric character, output "digit"; if it is another character, output "other". (The output does not contain double quotes).
Sample input Copy
1
Sample output Copy
digit

#include<stdio.h>
#include<ctype.h>
int main()
{
    
    
	char ch;
    ch=getchar();
	if(islower(ch))
	  printf("lower\n");
	  else if(isupper(ch))
	    printf("upper\n");
	    else if(isdigit(ch))
	      printf("digit\n");
	      else
	        printf("other\n");
	return 0;
}

Guess you like

Origin blog.csdn.net/m0_53024529/article/details/112742982
Recommended