C Program to Convert String to Lowercase Without strlwr

This C program converts all uppercase letters in the given string to lowercase without using string handling function strlwr().

C Source Code: String Lowercase Without strlwr


#include<stdio.h>

int main()
{
 char str[40];
 int i;

 printf("Enter string:\n");
 gets(str);

 for(i=0;str[i]!='\0';i++)
 {
  if(str[i]>='A'&& str[i]<='Z')
  {
   str[i] = str[i]+32;
  }
 }
 printf("String in lowercase is:\n");
 puts(str);
 
 return 0;
}

Output

Enter string:
WeLcOmE To C 101. ↲
String in lowercase is:
welcome to c 101.

Note: ↲ represents ENTER key is pressed.