0

Write a C program to find whether the given character is an alphabet, digit ,or special character using the if else statement

any body who can help?

31st Oct 2018, 7:15 AM
ALECKS
ALECKS - avatar
4 Respuestas
+ 6
Hi, how far have u come up to now. Surely u can do a littlebit yourself and link a program.
31st Oct 2018, 7:23 AM
Oma Falk
Oma Falk - avatar
+ 6
Hint: #include <ctype.h> For alphabets use isalpha() function. For digits use isdigit() function. For special characters use ispunct() function. Some examples on this site: https://www.includehelp.com/c-library-functions/ctype-example-programs.aspx
31st Oct 2018, 7:36 AM
Ipang
+ 1
Testing "a == num" is not the way to test a character type for being a digit. C provides library functions (in the ctype.h header) you should use in those cases, as it has been suggested by Ipang. Also, the linked site I think you will find very helpful in understanding what those functions do and how to use them. Other than that you are close. But you need to chain the if-statements using "else if" to mutually exclude each of the possibilities.
31st Oct 2018, 10:47 AM
Leif
Leif - avatar
31st Oct 2018, 8:39 AM
ALECKS
ALECKS - avatar