Read a string and convert it into Lower case

-- Leave a Comment
Hello Here is a program to convert A string inserted from users to lower case.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include<stdio.h>
void main()
{
char cname[100];
int i;
printf("Enter the name of your collage:-\n");
gets(cname);
for (i=0;cname[i]!='\0';i++)
    {
    if(cname[i]>='A' && cname[i]<='Z')
        cname[i]=cname[i]+32;
    }
puts(cname);
}

Here the program checks every alphabet if they are Upper case it will change all of them into lowercase else they will be as it is.

Hello This is Sagar Devkota. Studying Bachelor of Software Engineering at Pokhara University, NCIT. Open Source Enthusiastic.

0 comments:

Post a Comment