Convert Uppercase to Lowercase in CThis section will discuss the different programs to convert the uppercase letters (character or strings) into lowercase in the C programming language. The uppercase letter is the capital letter of the alphabet. For example, capital letters are A, B, C, D, …, X, Y, Z. Similarly, a lowercase letter is represented by the small letter of the alphabet. For example, small letters are a, b, c, d, e…., w, x, y, z. When we convert the capital letters or strings into lowercase using the ASCII codes, the process converts the uppercase to the lowercase letters in C programming. The ASCII value of the uppercase letter (A -Z) is ranging from 65 to 90, and the ASCII value of the lowercase letter (a -z) is ranging from 97 to 122. For example, we have the capital letter 'A' and want to convert it into lowercase letter 'a', we need to add 32 to the ASCII value of A (65) that returns character 'a' whose ASCII value is 97 (65 + 32). Similarly, we can convert the uppercase string 'HELLO' into the lowercase string 'hello'. Program to convert the uppercase character into lowercaseLet's write a program to convert the uppercase character into lowercase character in C programming language. Program1.c Output Enter the Upper Case Character: A A character in Lower case is: a Enter the Lower Case Character: z z character in the Upper case is: Z Program to convert the uppercase string into lower case using for loopLet's write a simple program to convert the uppercase string into lowercase using for loop in the C Programming. Program2.c Output Enter the string: WELCOME Upper Case to Lower case string is: welcome Program to convert the uppercase string into lower case using while loopLet's consider an example to print the lowercase string from uppercase using while loop in C programming. Program3.c Output Enter an upper case string: CPROGRAMMING The lowercase string is: cprogramming Program to convert the uppercase string into lowercase using the strlwr() functionStrlwr() function: The strlwr() function is a predefined function of the string library used to convert the uppercase string into the lowercase by passing the given string as an argument to return the lowercase string. Syntax The strlwr() function has a upr argument representing the uppercase string, and the strlwr() function takes upr argument to return a lowercase string. Let's create a program to convert the uppercase string into the lowercase using the built-in strlwr() function in C programming. Program4.c Output Enter the upper case string: GOOD BYE The lowercase string is: good bye Program to convert the uppercase string into lowercase using the user-defined functionLet's consider an example to convert the uppercase string into lowercase using the user-defined function in C programming. Program5.c Output Enter the upper case string: JAVATPOINT The lowercase string is: javatpoint Program to convert the uppercase string into lowercase using the recursion functionLet's consider an example to print the lowercase string from uppercase using the recursion function in the C programming. Program6.c Output Enter the upper case string: C PROGRAMMING LANGUAGE The lowercase string is: c programming language Next TopicUnary Operator in C |