Saturday, March 29, 2014

Get letter, digit or a symbol from user and distinguish whether he has entered small letter , capital letter , digit or symbol.

#include<stdio.h>
#include<stdlib.h>
void line()
{
int i,j;
printf("\n");
for(i=1;i<=42;i++)
printf("=");
}
void header()
{
printf("\n");
printf("Built and Designed by Arslan Malik\n\n www.CworldbyAS.blogspot.com");
printf("\n");
}
int main()
{
line();
header();
line();


char a;
printf("\nEnter any character = ");
scanf("%c",&a);
{
if (a>='A' && a<='Z')
printf("You have entered capital letter.\n",a);

else if (a>='a'  && a<='z')
printf("You have entered a small letter.\n",a);

else if (a>='0' && a<='9')
    printf("You have entered a digit.\n",a);

else printf("You have entered a special symbol.\n",a);

return 0;
}

No comments:

Post a Comment