Check a character is alphabet or not
Sample Output
Enter here: P P is an alphabet. Process returned 0 (0x0) execution time : 1.397 s Press any key to continue.
Source Code
#include<stdio.h> int main() { char ch; printf("Enter here: "); scanf("%c", &ch); if(ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z') { printf("\n%c is an alphabet.\n", ch); } else { printf("\n%c is not an alphabet.\n", ch); } return 0; }
Sample Output
Enter here: 9 9 is not an alphabet. Process returned 0 (0x0) execution time : 0.849 s Press any key to continue.
No comments:
Post a Comment