Subscribe Us

lower case to upper case in c without using string function or library function - c exercise-smartduniya


If you want to change lower case to upper case in c. There are many ways to change lower case to upper case in c programming.

In this post, you will learn, 

.
How to convert Lower case to upper case in c without using any library function or string function ?

You know that every character has a different  ASCII value. Even a capital letter and small letter has different ASCII value. 

We know that capital 'A'  ASCII value is 65 and small 'a a' ASCII value is 97. 

If we do ( lower case - upper case ) = 32 in ASCII value.

Remember that always lower case and upper case difference is 32.

WE can use this ASCII value to convert small letters to capital letters in c programming. Do you want to know how?

Let's go to the program...


#include <stdio.h>

int main (){

// code start

char upper;

printf(" Enter a lowercase letter : ");

scanf("%c", &upper); // %c use for charecter and &upper is used to store the input value

printf("Uppercase letter is : %c", upper-32 );

getchar();

}


 Write this above code on your text editor and save it in the ' .c ' extension.


when you run the program you get a display. I want input from you on any lower case letter.



When you give input from keyboard you see the screen. Here I give 'a' as input

Press Enter to Show the Result. We all know that small 'a' capital 'A'.
According to program, we see the result 'A'.

Our program Gives the correct result  Hope you run this lower case to upper case convert in c perfectly. If you face any problems comment below.


> How to convert Upper case To Lowercase in C 


Post a Comment

0 Comments