Uppercase to Lowercase

Lowercase to Uppercase

#include<stdio.h>
int main()
{

    char country[]={'b','a','n','g','l','a','d','e','s','h'};
    int i,length;
    printf("%s\n",country);
    length=10;
    for(i=0;i<length;i++){
        if(country[i]>=97 && country[i]<=122)
        {
            country[i]='A'+(country[i]-'a');

        }
    }
    printf("%s\n",country);

    return 0;
}

Uppercase to Lowercase

#include<stdio.h>
int main()
{
char country[]={'B','A','N','G','L','A','D','E','S','H'};
int i,length;
printf("%s\n",country);
length=10;
for(i=0;i<length;i++)
{
    if(country[i]>=65 && country[i]<=90)
    {
        country[i]='a'+(country[i]-'A');
    }
}
printf("%s\n",country);

return 0;
}

another method:

#include<stdio.h>
int main()
{
char country[]={'B','A','N','G','L','A','D','E','S','H'};
int i,length;
printf("%s\n",country);
length=10;
for(i=0;i<length;i++)
{
    if(country[i]>=65 && country[i]<=90)
    {
        country[i]=country[i]+32;
    }

}
printf("%s\n",country);

return 0;
}

 

 

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published.