Write a C program to Check whether the given character is an alphabet or not
Program:-
#include <stdio.h>
int main()
{
char ch;
printf(“Enter a character: “);
scanf(” %c”,&ch);
printf(“\n”);
if( (ch >= ‘a’ && ch <= ‘z’) || ( ch >= ‘A’ && ch <=’Z’))
printf(“%c is an alphabet\n”,ch);
else
printf(“%c is not an alphabet\n”,ch);
return 0;
}
int main()
{
char ch;
printf(“Enter a character: “);
scanf(” %c”,&ch);
printf(“\n”);
if( (ch >= ‘a’ && ch <= ‘z’) || ( ch >= ‘A’ && ch <=’Z’))
printf(“%c is an alphabet\n”,ch);
else
printf(“%c is not an alphabet\n”,ch);
return 0;
}
Output:-
....
0 comments:
Post a Comment