Write a C Program that input any Capital letter and display it with small letter

The program segment given below converts an uppercase letter to lowercase. As the C language allows arithmetic operations on characters, we can use expression such as ‘a’ – ‘A’,
‘g’ – ‘G’, etc. instead of literal 32.



#include <stdio.h>
#include<conio.h>
void main()
{
char letter = 0;
printf("Enter an uppercase letter: It);
scanf("%c", &letter);
if(letter >= 'A')
if (letter <= 'Z')
{
letter = letter - 'A'+ 'a';
printf("An uppercase %c\n", letter);
}
else
printf("A capital letter please.\n");
getch();
}
 
OUTPUT:
Enter an uppercase letter:
S
An uppercase s
Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment