Computer Science, asked by AyushSharma6542, 1 year ago

How do you write a program in C to convert capital letters into small letters?

Answers

Answered by ViewNew
0
Here are the two programs, first is to convert uppercase character to lowercase character and the second is to convert uppercase string to lowercase string in C programming. Let's first start with, how to convert a character from uppercase to lowercase in C programming.

Uppercase Character to Lowercase in C

Let's first convert character from uppercase to lowercase, so the following C program ask to the user to enter a character in uppercase to convert it into lowercase, then display the result on the screen. Since ASCII value of A is 65 and ASCII value of a is 97. So to convert a character from uppercase to lowercase, we have to add (97-65) i.e., 32 to get the ASCII value of the character in lowercase. Then print it on the screen :

C Programming Code to Convert Uppercase Character to Lowercase

/* C Program - Convert Uppercase Character to Lowercase */ #include<stdio.h> #include<conio.h> void main() { clrscr(); char ch; printf("Enter a character in uppercase : "); scanf("%c",&ch); ch=ch+32; printf("character in lowercase = %c",ch); getch(); }

Similar questions