Pages

Friday

Program to Convert Uppercase Characters to Lowercase in C

Here's a C program to convert uppercase characters to lowercase with output and proper explanation. This program uses C concepts like While Loop, Strings in C, Gets Function and Putchar Function.

# include <stdio.h>
# include <conio.h>
void main()
{
char str[80], con[80] , ch ;
int i = 0 ;
clrscr() ;
printf("Enter the text in uppercase : ") ;
gets(str) ;
printf("\nThe converted text is : ") ;
while(str[i] != '\0')
{
  if(str[i] != ' ')
    printf("%c", str[i] + 32) ;
  else
    putchar(' ') ;
  i++ ;
}
getch() ;
}


Output of above program

Enter the text in uppercase : I LOVE C PROGRAMMING
The converted text is : i love c programming

Note: For this program, the entire string has to be in uppercase.

No comments:

Post a Comment