Hi there,
I have to make c program that asks to enter a character and find out is it a number, letter or special character.
Here is what i tried:
Code:
#include <stdio.h>
#include <stdlib.h>
main(void)
{
char ch,a,z,c;
printf("Enter a character\n");
scanf("%c", &ch);
if (c >= 'a' && c <= 'z'){
printf("%c is a letter.\n", ch);
}
if (c >= '0' && c <= '9'){
printf("%c is a number.\n", ch);
}
switch(ch)
{
case '"':
case '{':
case '(':
case ')':
case '&':
case '^':
case '%':
case '*':
case '#':
case '!':
printf("%c is a special character.\n", ch);
break;
}
return 0;
}