Using Scanner class accept a number and check whether it’s an “alphabet”, a “digit”,
,”space” or “special symbol”.
Answers
Answered by
2
Answer:
Input : 8
Output : Digit
Input : E
Output : Alphabet
Explanation:
JAVA
// Java program to find type of input character
import java.io.*;
class GFG {
static void charCheck(char input_char)
{
// CHECKING FOR ALPHABET
if ((input_char >= 65 && input_char <= 90)
|| (input_char >= 97 && input_char <= 122))
System.out.println(" Alphabet ");
// CHECKING FOR DIGITS
else if (input_char >= 48 && input_char <= 57)
System.out.println(" Digit ");
}
}
hope it helps
Similar questions