Write a program in C to check that the given character is alphabet or digit or special symbol. Using conditional operator
#include<stdio.h> #include<conio.h> void main() { char ch; printf("Enter a character:-"); scanf("%c",&ch); ch>=65&&ch<=90||ch>97&&ch<=122?printf("%c is alphbet",ch):ch>=48&&ch<=57?printf("%c is digit",ch):printf("%c is special symbol",ch); getch(); }
Output:-
0 Comments