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");
- }
- }
- }
Learn More :
Negative
Integer
- How to Write a C program to perform basic math operations on two input whole numbers. The basic operations are addition, subtraction, multiplication, integer division, real division, and modulus.
- Sort Three Numbers - program reads in three Integers and displays them in ascending order.
- C program to Given a vector (integer or real), determine what is the maximum value of element what is the position in which this element is located
- C Program Generates 10 Random Integers Between 0 and 99.
- Give me an integer and I will sum it with the previous natural numbers
- Find the union and intersection of two sets of integer store it in two array C Program
- C Program to Detect int Underflow-Overflow using if-else
- Menu Driven Program to Read Two Integers Find Sum, Difference and Product C Program
Lower Case
- How To Write a C program that reads your first and last names and then converts them to upper-case and lower-case letters. The results will be printed to standard output console.
- C Program Anagrams
- C Program to Recursively converts all file-names to lower-case
- C Program to accept string from user & convert all lower case letters into upper case letters & vice versa
Upper Case
- How To Write a C program that reads your first and last names and then converts them to upper-case and lower-case letters. The results will be printed to standard output console.
- C Program To Print Text Into Uppercase
- C Program to convert a string to upper case
- C Program Anagrams
- C Program to accept string from user & convert all lower case letters into upper case letters & vice versa
Positive