C Program to change the Case of an Alphabet | Case Changing Program in C

Spread the love

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 **********/


Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer and an Open Source enthusiast, Presently working as a Software Engineer. Apart from that, I love to explore new technologies and things.

You may also like...

Leave a Reply