- Home
- Course Category
- Course Result
- Course Detail
Hot Line: 0124-2383121
Course Introduction
Programs for practice
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 :
Source Code: Convert Uppercase Character to Lowercase
/* C++ Program - Convert Uppercase Character to Lowercase */
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
char ch;
cout<<"Enter a character in uppercase : ";
cin>>ch;
ch=ch+32;
cout<<"character in lowercase = "<<ch;
getch();
}
Output
Enter a character in uppercase : B
character in lowercase =b