Monday, January 24, 2011

Managing Input and Output Operations

The program that requests the user to enter a character and displays a message on the screen
telling the user whether the character is an alphabet or digit, or any other special character.
#include<stdio.h>
void main()
{
char character;

printf("Press any key\n");
character = getchar();
if (isalpha(character) > 0)
printf("The character is a letter.");
else
if (isdigit (character) > 0)
printf("The character is a digit.");
else
printf("The character is not alphanumeric.");
getch();
}

No comments:

Post a Comment