
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert Uppercase to Lowercase in C Without String Convert Function
Before going to know about how to convert upper case to lower case letters without string convert function.
Let us have a look on program to convert upper to lower using convert function, then you will get a clarity on what we are doing in the program −
Example
#include <stdio.h> #include <string.h> int main(){ char string[50]; printf("enter a string to convert to lower case
"); gets(string); /reading the string printf("The string in lower case: %s
", strlwr(string)); //strlwr converts all upper to lower return 0; }
Output
enter a string to convert to lower case CProgramming LangUage The string in lower case: cprogramming language
Now let's see the program to convert upper to lower without using predefined function −
Example
#include<stdio.h> void main(){ //Declaring variable for For loop (to read each position of alphabet) and string// int i; char string[40]; //Reading string// printf("Enter the string : "); gets(string); //For loop to read each alphabet// for(i=0;string[i]!='\0';i++){ if(string[i]>=65&&string[i]<=90){ string[i]=string[i]+32; } } printf("The converted lower case string is : "); puts(string); }
Output
Enter the string : TUTORIALSPOINT The converted lower case string is : tutorialspoint
Advertisements