How to let C Program to recognize both lower and upper case input. Also Check if input is a positive integer, negative integer in C Programming Language ?
This C Program is to recognize both lower and upper case input. Also Check if input is a positive integer, negative integer in C Programming Language.
Output:
- Your input is positive even digit
- Your input is negative odd digit
- Your input is upper case letter
- Your input is lower case letter
Solution :
- #include<stdio.h>
- #include<string.h>
- void main()
- {
- char array[20];
- int i;
- for(i=0;i<5;i++){
- gets(array);
- if(strlen(array)==1){
- if(array[i]>=48 && array[i]<=57){
- if(array[i]%2==0)
- printf("Your input is positive even digit\n");
- else
- printf("Your input is negative odd digit\n");
- }
- if(array[i]>=65 && array[i]<=90)
- printf("Your input is upper case letter\n");
- else if(array[i]>=97 && array[i]<=122)
- printf("Your input is lowercase letter\n");
- }
- }
- }