Home » Convert Uppercase to Lowercase in C

Convert Uppercase to Lowercase in C

by Online Tutorials Library

Convert Uppercase to Lowercase in C

This 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’.

Convert Uppercase to Lowercase in C

Program to convert the uppercase character into lowercase

Let’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 loop

Let’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 loop

Let’s consider an example to print the lowercase string from uppercase using while loop in C programming.

Program3.c

You may also like