Sunday, April 1, 2012

Identify what is entered

Q. Write a C program to verify that entered word is character, number or symbol.

Ans.

/*c program for identify entered word is character, number or symbol*/
#include<stdio.h>
#include<conio.h>
int main()
{
 char ch;
 printf("Enter Any word : ");
 scanf("%ch", &ch);
 if((ch>='a' && ch<='z') || (ch>='A' && ch<='Z'))
    printf("You entered Alphabet!!");
 else if(ch>='0' && ch<='9')
    printf("You entered Number!!");
 else
    printf("You entered Symbol!!");
 getch();
 return 0;
}


/********************Output*****************/
Screen shot for what is entered by user C program



Related programs:
  1. Identify case of character C program
  2. How to change case of character C program
  3. Read and print string C program

No comments:

Post a Comment