Toggle the string case

#include <stdio.h>

int main()
{
    char str[100];
    int i;
    gets(str);
    for(i=0;str[i]!=NULL;i++)
    {
    if(str[i]>='A'&&str[i]<='Z')
    {
    str[i]+=32;
    }
    else if(str[i]>='a'&&str[i]<='z')
    {
    str[i]-=32;
    }
    }
    printf("%s",str);
    return 0;
}

Comments

Popular posts from this blog

Complementary Color

How to extract tweets from python.