C Tutorial
This program is used to check whether input character is alpha-numeric or not.
#include<stdio.h> #include<ctype.h> void main() { char character; printf("Enter any character: "); character = getchar(); if(isalpha(character) > 0) { printf("Character is letter\n"); } else if(isdigit(character) >0) { printf("Character is a digit\n"); } else { printf("Character is not alphanumeric"); } }Output:
$ cc character-type.c $ ./a.out Enter any character: s Character is letter $ ./a.out Enter any character: 3 Character is a digit $ ./a.out Enter any character: + Character is not alphanumeric
C Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us
| Report website issues in Github
| Facebook page
| Google+ page