Brijmohan lal Sahu - Facebook
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Tuesday, December 16, 2014

Program to check given character is in upper case or lower case and convert into upper or lower case in C.

Lower Character to Upper Character codeboxc


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: