C Program to Convert String Lowercase to Uppercase And Vice Versa

Problem:- Program to change lowercase to uppercase and vice-versa or C Program to Replace Lowercase Characters by Uppercase & Vice versa or Convert Upper to Lower Case Alphabets & Vice-versa or How to convert a given string into lowercase and uppercase without using library functions in C or C program to change case of a string or Case conversion (Lower to Upper and Vice Versa) of a string or conversion from uppercase to lowercase using c program or Convert all lowercase characters to uppercase and vice-versa.

Check This:- Hacker rank solution for Strings, Classes, STL, Inheritance in C++.

Explanation:- As we know that for an every character in keyboard has unique ASCII Value for Capital Alphabet(Upper Case) and Small Alphabet(Lower Case) so for converting a any case to any case (lower case to upper case and upper case to lower case) we have to remember number 32 cause this is a number for converting an any string into any case we have to just add the number 32 or minus the number 32 from each character of the string and we solved our conversion problem. I strongly recommend checking the ASCII program in C. So in this problem, we are just comparing if the number is less then the lower case ASCII number change convert it into the upper case or vice versa.

Also Check:- Geeksforgeeks solution for School, Basic, Easy, Medium, Hard in C++.

Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date for a new post or if you have any Query you can ask there with lots of coders also suggest to your Friends to join and like our page.



void main()
/*Visit - www.programmingwithbasics.com*/
    printf("\nVisit - www.programmingwithbasics.com");
char str[20];
    int i;

    printf("\n\nEnter The String: ");

    for (i=0;i<=strlen(str);i++)
        if (str[i]>=65&&str[i]<=90)
        str[i] = str[i] + 32;

        else if (str[i] >= 97 && str[i] <= 122)
        str[i] = str[i] - 32;
    printf("\n\nConvert String(Lower/Upper) Is: %s\n\n",str);

    return 0;


C Program to Convert String Lowercase to Uppercase And Vice Versa

You May Also See

1. C Program For Reverse A given Number Using While Loop

2. C Program To Find Number Is Armstrong Or Not using While Loop

3. C Program to Calculate Sum of Natural Numbers Using While Loop

4. C Program To Print Multiplication Table Using For Loop

5. C Program to Display Fibonacci Series Using While Loop

Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me