Code Box
---------------------------------------------
/* program to Check in put character is Lower or upper case and convert them into other case */
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
char c;
clrscr();
printf("\nEnter a character :");
scanf("%c",&c);
i=c;
if(i>=97 && i<=122)
{
printf("\nEntered Character is Lower Case : %c",c);
i=i-32;
c=(char)i; /*Explicit type conversion */
printf("\nUpper case Character is: %c",c);
}
else if(i>=65 && i<=90)
{
printf("\nEntered Character is Upper Case : %c",c);
i=i+32;
c=(char)i; /*Explicit type conversion */
printf("\nLower Case Character is: %c",c);
}
else
{
printf("\nPlease enter a correct case Character");
}
getch();
}
No comments:
Post a Comment