C Program to convert uppercase string to lowercase


In this program, You will learn how to convert uppercase string to lowercase in c.


Hello Abc => hello abc

Welcome to Xiith => welcome to xiith


Example: How to convert uppercase string to lowercase in c

Run it Now
#include<stdio.h>

int main() {

   char str[100];
   int i = 0;

   printf("Enter a String :");
   fgets(str, 100, stdin);

   while (str[i] != '\0') {
       i++;
   }

   for (int j = 0; j < i; j++) {
       if (str[j] >= 65 && str[j] <= 90)
           str[j] = str[j] + 32;
   }
   printf("\nLowercase String is :%s", str);

   return 0;
}

Output:

Enter a String :JOHN Smith
Lowercase String is :john smith