How to make C programm to check wheither given charecter is in a lower case alphabet or upper case alphabet using switch ?
Answers
Answered by
2
#include <stdio.h>
int main()
{
char ch; /* Input character from user */
printf("Enter any character: ");
scanf("%c", &ch); if(ch >= 'A' && ch <= 'Z')
{
printf("'%c' is uppercase alphabet.", ch);
}
else if(ch >= 'a' && ch <= 'z')
{
printf("'%c' is lowercase alphabet.", ch);
}
else { printf("'%c' is not an alphabet.", ch);
}
return 0;
}
int main()
{
char ch; /* Input character from user */
printf("Enter any character: ");
scanf("%c", &ch); if(ch >= 'A' && ch <= 'Z')
{
printf("'%c' is uppercase alphabet.", ch);
}
else if(ch >= 'a' && ch <= 'z')
{
printf("'%c' is lowercase alphabet.", ch);
}
else { printf("'%c' is not an alphabet.", ch);
}
return 0;
}
9552688731:
using switch conditional statement bro not if else
Similar questions