Q. Write a string to accept string through keyboard and convert it Lower Case letter.
Ans.
/*program to convert a string in lower case letter*/
#include<stdio.h>
#include<string.h>
int main()
char str[40];
int i;
printf("Enter any string : ");
gets(str);
for(i=0; str[i]!=NULL; i++)
{
if(str[i]>='A' && str[i]<='Z')
{
str[i]=str[i]+32;
}
}
str[i]='\0';
puts(str);
getch();
getch();
return 0;
}
Output:-
Enter any string : My C ProgrammING CodeS
my c programming codes
Comments
Post a Comment