C Program to Replace all Characters by Lowercase

«
»

This is a C Program to replace all the characters by lowercase.

Problem Description

This is a C Program to replace all the characters by lowercase.

Problem Solution

1. Take a string as input.
2. Use string function strlwr to replace all the characters by lowercase.

advertisement
Program/Source Code

Here is source code of the C Program to replace all the characters by lowercase. The C program is successfully compiled and run on a Linux system. The program output is also shown below.

  1. /*
  2.  * C Program to Replace all the Characters by Lowercase 
  3.  */
  4. #include <stdio.h>
  5. #include <string.h>
  6.  
  7. int main()
  8. {
  9.    char string[1000];
  10.  
  11.    printf("Input a string to convert to lower case\n");
  12.    gets(string);
  13.  
  14.    printf("Input string in lower case: %s\n",strlwr(string));
  15.  
  16.    return  0;
  17. }
Program Explanation

1. Take a string as input and store it in the array string[].
2. Using strlwr function replace all the characters by lowercase.

Note: Join free Sanfoundry classes at Telegram or Youtube
advertisement
advertisement
Runtime Test Cases
Input a string to convert to lower case
CHANDANA chanikya
rAVELLA
 
Input string in lower case:
chandana chanikya
ravella

Sanfoundry Global Education & Learning Series – 1000 C Programs.

Here’s the list of Best Books in C Programming, Data-Structures and Algorithms

advertisement
If you wish to look at programming examples on all topics, go to C Programming Examples.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses.