Program to find whether a character is Alphabet, Digit or Special Character
#include<stdio.h>
void main()
{
char ch;
printf("\nEnter the Character:");
scanf("%c",&ch);
if(ch>=65 && ch<=90 ||ch>=97 && ch<=122)
printf("\nEntered character is Alphabet");
else if(ch>=48 && ch<=57)
printf("\nEntered character %c is Digit",ch);
else if(ch>=123 && ch<=127 ||ch>=91 && ch<=96 || ch>=32 && ch<=47|| ch>=58 && ch<=64)
printf("\nEntered character %c is Special Character",ch);
else
printf("\nEntered character %c is Non Priantable Character",ch);
}
void main()
{
char ch;
printf("\nEnter the Character:");
scanf("%c",&ch);
if(ch>=65 && ch<=90 ||ch>=97 && ch<=122)
printf("\nEntered character is Alphabet");
else if(ch>=48 && ch<=57)
printf("\nEntered character %c is Digit",ch);
else if(ch>=123 && ch<=127 ||ch>=91 && ch<=96 || ch>=32 && ch<=47|| ch>=58 && ch<=64)
printf("\nEntered character %c is Special Character",ch);
else
printf("\nEntered character %c is Non Priantable Character",ch);
}
Comments
Post a Comment