C program to convert uppercase to a lowercase string using ASCII values
codeaft.c
#include<stdio.h>
#include<string.h>intmain(){chars[20];inti;printf("———————————————————————————————————————————");printf("\nProgram to convert upper to a lowercase string");printf("\n———————————————————————————————————————————");printf("\nEnter the string ");scanf("%s",s);for(i=0;i<=strlen(s);i++){if(s[i]>=65&&s[i]<=92)s[i]=s[i]+32;}printf("\nThe lowercase string is %s",s);printf("\n———————————————————————————————————————————\n");return0;}
Output
codeaft@codeaft:~$ gcc codeaft.c codeaft@codeaft:~$ ./a.out
———————————————————————————————————————————
Program to convert upper to a lowercase string
———————————————————————————————————————————
Enter the string WELCOME
The lowercase string is welcome
———————————————————————————————————————————
codeaft@codeaft:~$
C program to convert uppercase to a lowercase string using tolower() function
codeaft.c
#include<stdio.h>intmain(){chars[20];inti;printf("———————————————————————————————————————————");printf("\nProgram to convert upper to a lowercase string");printf("\n———————————————————————————————————————————");printf("\nEnter the string ");scanf("%s",s);for(i=0;s[i];i++)s[i]=tolower(s[i]);printf("\nThe lowercase string is %s",s);printf("\n———————————————————————————————————————————\n");return0;}
Output
codeaft@codeaft:~$ gcc codeaft.c codeaft@codeaft:~$ ./a.out
———————————————————————————————————————————
Program to convert upper to a lowercase string
———————————————————————————————————————————
Enter the string WELCOME
The lowercase string is welcome
———————————————————————————————————————————
codeaft@codeaft:~$
Dear User, Thank you for visitng Codeaft. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.