Write a short program ro check whether the given characters is a digit or a letter
Answers
Answered by
1
Answer:
Explanation:
If you want to know if a character is a Unicode letter or digit, then use the Character.isLetter and Character.isDigit methods.
If you want to know if a character is an ASCII letter or digit, then the best thing to do is to test by comparing with the character ranges 'a' to 'z', 'A' to 'Z' and '0' to '9'.
Answered by
1
Answer:
#include <stdio.h>
int main()
{
char ch;
/* user has to insert values and it will be checked by the condition*/
printf("enter the character");
scanf("%c",&ch);
/* this is the condition to check the input given by the user is digit or not*/
if(ch>='0'&&ch<='9')
{
printf("it is a digit");
}
else{
printf("it is not a digit");
}
return 0;
}
Similar questions
History,
5 months ago
Physics,
5 months ago
Science,
5 months ago
CBSE BOARD X,
10 months ago
Science,
10 months ago
English,
1 year ago
Social Sciences,
1 year ago