This program is a simple program that takes a string as input and converts all the uppercase letters in the string to lowercase.
The program starts by including the stdio.h header file, which contains the declarations of the functions used in the program.
In the main function, the program declares a character array "a" of size 100 , and an integer variable "i" for the loop.
It uses the printf function to prompt the user to enter the string and uses the gets function to read the input and store it in the "a" array.
The program then uses a for loop to iterate through the string. Inside the loop, it uses an if statement to check if the current character's ASCII value is within the range of uppercase letters. If it is, it adds 32 to the ASCII value of the current character to convert it to its corresponding lowercase letter.
Finally, the program uses the puts function to print out the modified string and returns 0 to indicate that the program has executed successfully.
It's worth noting that the gets function is considered dangerous and should not be used as it's prone to buffer overflow, fgets is recommended instead.
// Write a program to convert string to lowercase in c program #include<stdio.h> int main() { /* a-z => 97-122 A-Z => 65-90 0-9 => 48-57 space => 32 */ char a[100]; int i; printf("\nEnter The String : "); gets(a); for(i=0;a[i]!='\0';i++) { if(a[i]>=65 && a[i]<=90) a[i]=a[i]+32; } puts(a); return 0; }To download raw file Click Here
Enter The String : TUTOR JOES tutor joes
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions