C Program to change the Case of an Alphabet | Case Changing Program in C
C Program to change the case of Alphabet:
#include<stdio.h>
void main()
{
char ch;
Label:
printf(“Enter any character :”);
scanf(” %c”,&ch);
if(isalpha(ch))
{
if(isupper(ch))
{
printf(“Given Character : %c n”,ch);
printf(“After Case changing : %c n”,ch+32);
// Ascii Values of A is 65 and a = 97, similarly B=66,b=98 so difference is 32
}
else
{
printf(“Given Character : %c n”,ch);
printf(“After Case changing : %c n”,ch-32);
// same as above but here ch is lowercase so subtracting 32.
}
}
else
{
printf(“Given No is not an alphabet..n”);
goto Label;
}
}
/******** OUTPUT **********/