[et_pb_section fb_built=”1″ _builder_version=”4.4.0″][et_pb_row _builder_version=”4.4.0″][et_pb_column type=”4_4″ _builder_version=”4.4.0″][et_pb_text _builder_version=”4.4.2″ text_font=”Verdana||||||||” text_text_color=”#000000″ text_font_size=”16px” text_letter_spacing=”1px” custom_padding=”||0px|||” hover_enabled=”0″]

Converting string uppercase to lowercase

converting string uppercase to lower-in this tutorial – we will discuss how to convert uppercase into the lowercase string using the built-in method and without using the Built-in method in C programming language-C language provides us the inbuilt method tolower() to change an uppercase to the lowercase string.

 

[/et_pb_text][et_pb_text _builder_version=”4.4.1″ header_4_font=”|600|||on||||” header_4_text_color=”#000000″ min_height=”0px” custom_margin=”-23px|||||”]

Using tolower()

[/et_pb_text][et_pb_text _builder_version=”4.4.1″ text_font=”|600|||||||” text_text_color=”#000000″ text_font_size=”15px” border_radii=”on|8px|8px|8px|8px” border_width_all=”3px” border_style_all=”double”]
int main()
{
   char st[]="MANAS HALDER";
   char ch; 
   for(int i=0; st[i]!='\0'; i++)
    {
      ch=st[i];
      printf("%s"(tolower(ch));
    }
   return 0;
}
[/et_pb_text][et_pb_image src=”https://digitalmind.online/wp-content/uploads/2020/03/upr_lwr.png” _builder_version=”4.4.1″][/et_pb_image][et_pb_text _builder_version=”4.4.2″ text_font=”Verdana||||||||” text_text_color=”#000000″ text_font_size=”17px” custom_padding=”||0px|||” hover_enabled=”0″]

Now we will see that without using a built-in method how to convert uppercase string to lowercase string?

Before converting string uppercase to lowercase we need to know about the ASCII code. An ASCII code is the method of representing characters as an integer, which is a 7-bit representation.

For uppercase letters that is A, B, C, D …… X, Y, Z, and the ASCII values lie in the range of 65,66,67……89,90.

For lowercase letters that are for a,b,c,d…..x,y,z, the ASCII values lie in the range of 97,98,99,…….122.

Logic is that we check the ASCII code of the character if the ASCII code lies between 65 to 90 then add 32 so that it will automatically be converted from uppercase to lowercase string.

 

[/et_pb_text][et_pb_text _builder_version=”4.4.0″ header_4_font=”|600|||||||” header_4_text_align=”center” header_4_text_color=”#000000″]

Source Code

[/et_pb_text][et_pb_text _builder_version=”4.4.1″ text_font=”Verdana|600|||||||” text_text_color=”#000000″ text_font_size=”15px” border_radii=”on|8px|8px|8px|8px” border_width_all=”3px” border_style_all=”double”]
int main(){   char str[25];   int i;   printf("\nEnter the string to change the case");   gets(str);   for(i=0; str[i]!='\0'; i++)   {      if(str[i]>='A'&& str[i]<='Z')          str[i]=str[i]+32;       }   printf("\nNew string is=%s", str);}
[/et_pb_text][et_pb_text _builder_version=”4.4.0″ header_4_font=”|600|||||||” header_4_text_align=”center” header_4_text_color=”#000000″]

Output

[/et_pb_text][et_pb_image src=”https://digitalmind.online/wp-content/uploads/2020/03/uplo-1.png” _builder_version=”4.4.1″][/et_pb_image][et_pb_text _builder_version=”4.4.0″ text_font=”Verdana||||||||” text_text_color=”#000000″ text_font_size=”16px” text_letter_spacing=”1px” hover_enabled=”0″]

As we mentioned before all the upper case characters [A to Z] ASCII value ranging from 65 to 90 and lower case character [a to z] ASCII value ranging from 97 to 122. So the following program we are going to use direct  ASCII value instead of using characater.

[/et_pb_text][et_pb_text _builder_version=”4.4.1″ text_font=”Verdana|600|||||||” text_text_color=”#000000″ text_font_size=”15px” border_radii=”on|8px|8px|8px|8px” border_width_all=”3px” border_style_all=”double”]
int main()
{
   char st[25];
   int i,len;
   printf("\n\n\tEnter the string");
    gets(st);
   len=strlen(st);
   for(i=0; i<len; i++)
    {
      if(st[i]>=65 && st[i]<=95)
           st[i]=st[i]+32;
     }
    printf("\n\n\tNew String is=%s",st);
}

[/et_pb_text][et_pb_text _builder_version=”4.4.0″ header_4_font=”Verdana|600|||||||” header_4_text_align=”center” header_4_text_color=”#000000″]

output

[/et_pb_text][et_pb_image src=”https://digitalmind.online/wp-content/uploads/2020/03/uplo1.png” _builder_version=”4.4.1″][/et_pb_image][et_pb_text _builder_version=”4.4.2″ header_3_font=”Verdana|600|||||||” header_3_text_color=”#000000″ hover_enabled=”0″]

Recommended Post is following

How to write a C program to convert lowercase to uppercase string using builtin and without builtin method.

How to Write a C program to find out the Second smallest number of Array elements.

How to Write a C program to find out the Second highest number of Array elements.

How to write Right Triangle using star “*” symbol in C program

How to make “X” type pattern using the symbol in C programming

you can check out my Facebook page also

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]