×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
Find the frequency of character in a sentence - String Accept a string and convert it in upper case - String
Accept a string and convert it in lower case - String - String - C Language
1570    Arnab De    27/04/2019

Write a program to accept a string or name from the user and convert it in lower case.

Read a string from user using gets(). Now travel the whole string and check it is an alphabet or Not. If it is an alphabet then check is it a upper case character [ASCII between 65 - 90], if it is a upper case character then add 32 with it and convert into lower case character. Now print the string using puts().

softetechnologies
int main()
{
	char str[30],i;
	//READ A STRING
	printf("Enter A String: ");
	gets(str);
	for(i=0;str[i]!='\0';i++)
	{
		if((str[i]>=65 && str[i]<=90) ||(str[i]>=97 && str[i]<=122))
		{
			if(str[i]>=65 && str[i]<=90)
			{
				str[i]=str[i]+32;
			}
		}
	}
	//PRINT THE OUTPUT
	printf("Result : ");
	puts(str);
	return 0;
}
softetechnologies
Find the frequency of character in a sentence - String Accept a string and convert it in upper case - String
softetechnologies
Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
Enter New Comment
Comment History
No Comment Found Yet.
Swami Vivekananda
All that man has to do is to take care of three things; good thought, good word, good deed.
Swami Vivekananda
1801
69.48
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     50613
25/06/2018     42600
01/01/2018     41783
28/06/2017     39564
02/08/2017     38354
01/08/2017     32578
06/07/2017     32274
15/05/2017     31730
14/07/2017     27864
11/09/2018     27601
softetechnologies