In this C program, we will learn how to write a program to convert uppercase string to lower case.
Here is the code of the program to convert uppercase string to lower case.
/* C program to convert uppercase string to lower case */
#include<stdio.h>
#include<string.h>
int main(){
/* This array can hold a string of upto 25
* chars, if you are going to enter larger string
* then increase the array size accordingly
*/
char str[25];
int i;
printf("Enter The String: ");
scanf("%s",str);
for(i=0;i<=strlen(str);i++){
if(str[i]>=65&&str[i]<=90)
str[i]=str[i]+32;
}
printf("\nLower Case String is: %s",str);
return 0;
}
Enter The String: TUTORIALSRACK
Lower Case String is: tutorialsrack
--------------------------------
Process exited after 5.957 seconds with return value 0
Press any key to continue . . .
Comments