Computer Science, asked by bindumolthomas2017, 10 months ago

Write a short program ro check whether the given characters is a digit or a letter

Answers

Answered by vanshabhinav32
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 sougatap57
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