Write C program to check whether a character is an alphabet or not.

TASK-

Write a program that ask user to a character and check whether a character is an alphabet or not.

OUTPUT:

1- The character is not an alphabet


2- The character is an alphabet


CODE:

#include<stdio.h>
int main(){

char ch;  //initialization of variable of data type character.

printf("Enter a character ");
scanf("%s",&ch);// NOTE that ! we use %s for char;

if ((ch>='A'&&ch<='Z' )|| (ch>='a' && ch<='z'))
printf("\nThe character written is an alphabet");

else
printf("\nThe character written is not an alphabet");

getchar();
return 0;

}

NEED WORK PRODUCE WORK

My name is Abdul Rehman I am from Pakistan. I am doing BS in Computer and information sciences. Currently, I am creating these blogs to help students of computer sciences all over the world..

2 Comments

Post a Comment
Previous Post Next Post