Table of Contents
show
strlwr()
Converts upper case string to lowercase
strlwr(string_name);
Program: Convert string to lowercase using library function
#include<stdio.h>
#include<string.h>
int main()
{
char s[100];
puts("Ener string in uppercase");
gets(s);
strlwr(s);
puts("After converting to lowercase,");
puts(s);
return 0;
}
Output
Ener string in uppercase
ITECHBITZ
After converting to lowercase,
itechbitz
Program: Convert string to lowercase without using library function
#include<stdio.h>
#include<string.h>
int main()
{
char s[100];
int i=0;
puts("Enter string in uppercase");
gets(s);
while(s[i] != '\0')
{
if(s[i] >=65 && s[i]<=90)
{
s[i] = s[i] +32;
i++;
}
}
puts("After converting to lowercase");
puts(s);
return 0;
}
Output
Enter string in uppercase
ITECHBITZ
After converting to lowercase
itechbitz
Views: 0