C Program to Convert String Lowercase to Uppercase And Vice Versa

Shall I start the article to teach the topic “C Program to Convert String Lowercase to Uppercase And Vice Versa” to you? Come on! Let’s go for an article to see the possibilities to learn about it.

C Program to Convert String Lowercase to Uppercase And Vice Versa

C Program to Convert String Lowercase to Uppercase And Vice Versa

Program Code

#include<stdio.h>
#include<string.h>

void main()
{
 /*Visit - www.programmingwithbasics.com*/
   
    printf("=====================================");
    printf("nVisit - www.programmingwithbasics.com");
    printf("n=====================================");
    
    while(1)
    {
 char str[20];
    int i;

    printf("nnEnter The String: ");
    scanf("%s",str);

    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("nnConvert String(Lower/Upper) Is: %snn",str);
 }

    return 0;
}

Final Words

I hope this article helps you to know about “C Program to Convert String Lowercase to Uppercase And Vice Versa”. If you face any issues please let me know via the comment section. Share this article with other C/C++ developers via social networks. Thank You!

Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment