Change the letter if it is in lower case to upper and vice-versa
/*WAP to change
the letter if it is in lower case to upper and vice-versa*/
#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
clrscr();
printf("enter
the letter:");
scanf("%c",&ch);
if(ch>=65
&& ch<=92)
{
ch=ch+32;
printf("letter
is in upper case and its lower case is %c",ch);
}
else if(ch>=96
&& ch<=122)
{
ch=ch-32;
printf("letter
is in lower case and its upper case is %c",ch);
}
else
printf("INVALID
LETTER");
getch();
}
OUTPUT:
enter the
letter:g
letter is in
lower case and its upper case is G
No comments:
Post a Comment