Pages

Saturday, 20 June 2015

User defined string function to uppercase to lower case

User defined string function to convert a given string uppercase to lower case

Coding:
#include
void mystrlwr(char *a)
{
int i;
for(i=0;a[i]!='\0';i++)
{
if(a[i]>=65 && a[i]<=90)
a[i]=a[i]+32;
}
}
int main()
{
char a[30];
printf("Please enter the string:");
gets(a);
mystrlwr(a);
printf("String in Upper Case:%s",a);
return 0;
}

Output:
Please enter the string:ProGraM
String in Upper Case:program