Wednesday, 19 October 2016

C Program to convert a uppercase letter into lowercase or lowercase into uppercase

This is a C Program to convert a uppercase letter to lowercase. This is done by the ASCII values .

So You can see the difference between ASCII values of 'A' and 'a' is 32. So we have to add 32 to get lowercase of a uppercase letter. Click 'Read More' for the code.
 Code :

#include<stdio.h>
#include<conio.h>
void main()
{char ch;
printf("\t\t\tUpper Case to Lower Case Converter");
printf("\n\nEnter a character in Upper Case ");
scanf("%c",&ch);
printf("The Character in lower case is %c",(ch+32));//use ch-32 to convert a lowercase into uppercase
getch();
}


Output:

                        Upper Case to Lower Case Converter

Enter a character in Upper Case S
The Character in lower case is s





































No comments:

Post a Comment