-
Notifications
You must be signed in to change notification settings - Fork 20
/
CheckCharacter.c
34 lines (33 loc) · 1.2 KB
/
CheckCharacter.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/******************************************************
* File : CheckCharacter.c
* Description : Program to check the given character
* is a capital letter, small letter, number or a special character
* A-Z : 65-90, a-z : 97-122, 0-9: 48-57
* Special Characters: 0-47,58-64,91-96, 123-127
* Author : Sarju S
* Version : 1.0
* Date : 04/06/2021
* ***************************************************/
#include<stdio.h>
int main(){
char ch;
printf("\nEnter the character:");
scanf("%c",&ch);
//If the ASCII Value is between 65 and 95 then it is a Capital Letter
if(ch>=65 && ch<=95){
printf("\nThe given character is a Capital Letter");
}
//If the ASCII Value is between 97 and 122 then it is a Small Letter
else if(ch>=97 && ch<=122){
printf("\nThe given character is a Small Letter");
}
//If the ASCII Value is between 97 and 122 then it is a Small Letter
else if(ch>=48 && ch<=57){
printf("\nThe given character is a Number");
}
//This is a special character
else{
printf("The given character is a special character");
}
return 0;
}