Lower-Upper Case/Positive-Negative Integer

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:

  1. Your input is positive even digit
  2. Your input is negative odd digit
  3. Your input is upper case letter
  4. Your input is lower case letter

Solution :

  1. #include<stdio.h>
  2. #include<string.h>
  3. void main()
  4. {
  5.     char array[20];
  6.     int i;
  7.   for(i=0;i<5;i++){
  8.     gets(array);
  9.   if(strlen(array)==1){
  10.   if(array[i]>=48 && array[i]<=57){
  11.     if(array[i]%2==0)
  12.      printf("Your input is positive even digit\n");
  13.     else
  14.      printf("Your input is negative odd digit\n");
  15.   }
  16.   if(array[i]>=65 && array[i]<=90)
  17.     printf("Your input is upper case letter\n");
  18.   else if(array[i]>=97 && array[i]<=122)
  19.     printf("Your input is lowercase letter\n");
  20.   }
  21.   }
  22. }


Learn More :