C Program- To change string into lower case

Posted: January 14, 2012 in Lab 1
#include<stdio.h>
int main()
{
char str1[100],*ptr;
printf("Enter any string in upper case\n");
gets(str1);
ptr=str1;
for(;*ptr!='\0';ptr++)
{

if(*ptr==' ')
continue;
if(*ptr>=65&&*ptr<=90)
*ptr=*ptr+32;
}
puts(str1);
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s