C Program to convert uppercase characters in a string to lowercase characters using loop or strlwr string function. How to convert uppercase characters in a string to lowercase characters using loop or strlwr string function. Logic to convert uppercase characters in a string to lowercase characters in C language.
#include <stdio.h>
void main()
{
char str[50];
int i=0;
printf("Enter uppercase string: ");
gets(str);
for (i = 0; str[i] != '\0'; i++)
{
if(str[i]>='a' && str[i]<='z')
{
str[i] = str[i] + 32;
}
}
printf("Lowercase string: %s", str);
}
strlwr()
function#include <stdio.h>
#include <string.h>
void main()
{
char str[50];
printf("Enter uppercase string: ");
gets(str);
strlwr(str);
printf("Lowercase string: %s", str);
}
Output
Enter uppercase string: PROCODING Lowercase string: procoding