write a c++ program to find whether the given character is a digit ,alphabet or a number.
Answers
Answered by
1
#include<iostream.h>
int main ()
{
int a ;
cout<<"Enter a character";
cin>>a;
if( isdigit(a))
{
cout<<a<<"is a digit";
}
else if(isalpha(a) )
{
cout<<a<<"is a alphabet";
}
else
{
cout<<a<<"is a symbol";
}
return 0;
}
int main ()
{
int a ;
cout<<"Enter a character";
cin>>a;
if( isdigit(a))
{
cout<<a<<"is a digit";
}
else if(isalpha(a) )
{
cout<<a<<"is a alphabet";
}
else
{
cout<<a<<"is a symbol";
}
return 0;
}
Answered by
0
write a C program to read a character from user find whether the character is alphabet digit or special symbol.
Explanation:
#include<stdio.h>
int main()
{
char ch;
printf("Enter the Character");
scanf("%c",&ch);
if((ch>=65 && ch<=90)||(ch>=97 && ch<=122))
printf("it's a alphabet ");
else if(ch>='0' && ch<='9')
printf("it's a Number ");
else
printf("it's a symbol");
return 0;
}
Similar questions