Example & Tutorial understanding programming in easy ways.

Write a program to convert the lower case alphabet to upper case alphabet

UPPERcase alphabet:

Example-
A,B,C,D,.........,X,Y,Z
All these alphabet is the upper case.
ASCII value for upper case alphabet:
A=65
B=66
C=67
.....
Y=89
Z=90

Lower-case alphabet:

Example-
a,b,c,d,...........,x,y,z
All these alphabet is of lower case.
ASCII value for lower case alphabet:
a=97
b=98
c=99
.....
y=121
Z=122

program-

#include < stdio.h>
int main()
{
char ch;
printf("Enter lower case alphabet");
scanf("%c",&ch);
printf("Its upper case is %c",ch-32);
return 0;
}


output-

Enter lower case alphabet
a
Its upper case is A

Enter lower case alphabet
j
Its upper case is J

-In this program, we take a input of the lower case alphabet and try to convert it into the UPPER case alphabet.
-We use ASCII value to do this.
-Difference between ASCII value of UPPER case and lower case alphabet is 32.
-So 'lower_case'-32=UPPER_CASE




Read More →