String to Lower Case

CODE :


#include<stdio.h>

void main()
{
    int i=0,j=0, length;
    char str[100];

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

    for(i=0; str[i]!='\0';i++)
    {}
    length = i ;

    for(j=0; j<length; j++)
    {
        if(str[j]==32)//ascii of space
        {
            continue;//skip iteration to skip space character
        }
        else if(str[j]>=65 || str[j]<=90 )
        {
            str[j]=str[j]+32;
        }
    }
    printf("String in lower case is : ");
    puts(str);

}

Post a Comment

CodeNirvana
Newer Posts Older Posts
© Copyright Encyclopedia of C | Designed By Code Nirvana
Back To Top