In this blog let us see how to train the compiler so that it gives the output according to the user commands.
![](https://prequelcoding.in/wp-content/uploads/2022/10/Slide1-1024x576.jpg)
Let us see the coding part now:
#include <stdio.h> #include <math.h> int main() { char ch; scanf("%c", &ch); //input from the user if((ch >= 'a' && ch <= 'z')){ //the input is going to range between the alphabets a to z which is invoked using the if loop statement && operator is used because it is going to evaluate true even if both the operands are true. printf("%c is alphabet", ch); //if the condition is satisfied then the output will be a alphabet } else if(ch>= '0' && ch <= '100'){ //if the input is given in the form of a number instead of a alphabet then the loop is shifted from if to else if which returns the condition from being a alphabet to a digit. printf("%c is digit", ch); } else{ printf("%c is symbol", ch); //if the input given by the user is either a number or an alphabet then the condition evaluated is going to be a symbol. } return 0; }
//output
![](https://prequelcoding.in/wp-content/uploads/2022/10/image.png)
![](https://prequelcoding.in/wp-content/uploads/2022/10/image-1.png)
![](https://prequelcoding.in/wp-content/uploads/2022/10/image-2.png)