conversion from uppercase to lowercase using c language | CTechnotips

Conversion from uppercase to lower case using c program

int main(){
  char str[20];
  int i;
  printf("Enter any string->");
  printf("The string is->%s",str);
  printf("\nThe string in uppercase is->%s",str);
  return 0;


ASCII value of 'A' is 65 while 'a' is 97. Difference between them is 97 – 65 = 32
So if we will add 32 in the ASCII value of 'A' then it will be 'a' and if will we subtract 32 in ASCII value of 'a' it will be 'A'. It is true for all alphabets.
In general rule:
Upper case character = Lower case character – 32
Lower case character = Upper case character + 32


Post a Comment