google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a program to check the entered character is alphabet digit or special character - 2nd puc computer science

Write a program to check the entered character is alphabet digit or special character

Write a program to check the entered character is alphabet digit or special character

#include<stdio.h>

#include<conio.h>

void main()

{

char ch;

clrscr();

printf("Enter the character: ");

scanf("%c",&ch);

if(ch>='a'&&ch<'z'||ch>='A'&&ch<='Z')

printf("%c is an alphabet",ch);

else if(ch>='0'&&ch<='9')

printf("%c is a digit",ch);

else

printf("%c is a special symbol",ch);

getch();

}

Output:

 

run 1:

Enter the character: a

a is an alphabet

 

run 2:

Enter the character: A

A is an alphabet

 

run 3:

Enter the character: 5

5 is a digit

 

run 4:

Enter the character: @

@ is a special symbol


Write a program to check the entered character is alphabet digit or special character Write a program to check the entered character is alphabet digit or special character Reviewed by Vision Academy on December 22, 2021 Rating: 5

No comments:

CheckOut

Powered by Blogger.