C Program to Convert Character Cases
Write C Program to convert a character from upper to lower and lower to upper case
#include <stdio.h> int main () { char upper, lower; // declare variables int ascii; // convert in lower case printf (" Enter the Upper Case Character :--> "); scanf (" %c", &upper); ascii = upper + 32; printf ("Lower case of %c : %c", upper, ascii); // convert in upper case printf ("\n Enter the Lower Case Character :--> "); scanf (" %c", &lower); ascii = lower - 32; printf ("Upper case of %c : %c", lower, ascii); return 0; }
Output:
Enter the Upper Case Character :--> U
Lower case of U :--> u
Enter the Lower Case Character :--> q
Upper case of q :--> Q