Uppercase to Lowercase
Algorithm
Input Uppercase character. Output Lower case character. Complexity O (n). Upper to lower case (char[]) 1. Set n=number of character in char[]; 2. For i=1 to n 3. Do if (65 <=char[i] <=90) 4. Then char[i]=(char[i]+32); 5. Print char[i];
Algorithm Description
Char[] :character array;
For loop for each element in the array. If integer value corresponding a character lie between 65 to 90 this means it’s a upper case character ,by adding 32 it can be converted to lower case.
C Code
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
char str[100];
int i,n,d;
printf(" \n enter the string in upper case : ");
gets(str);
n=strlen(str);
for(i=0 ;i<n ;i++)="" {="" d="str[i];" if(d="">=65 && d<=90)
{
printf("%c",d+32);
}
else
{
printf("%c",str[i]);
}
}
return(0);
}