Convert string to lowercase in C


Internally characters in C are represented as an integer value known as ASCII value. Which means if we write a or any other character it is translated into a numeric value in our case it is 97 as ASCII value of a = 97

Source Code

// Write a program to convert string to lowercase in c program
#include<stdio.h>
int main()
{
    /*
        a-z  => 97-122
        A-Z  => 65-90
        0-9  => 48-57
        space => 32
    */
    char a[100];
    int i;
    printf("\nEnter The String : ");
    gets(a);
    for(i=0;a[i]!='\0';i++)
    {
        if(a[i]>=65 && a[i]<=90)
            a[i]=a[i]+32;
    }
    puts(a);
    return 0;
}
 
To download raw file Click Here

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C


Learn All in Tamil © Designed & Developed By Tutor Joes