Q:

Wrong answer while Changing the upper case letters to lower case and vice versa

I can't identify the mistake. In place of a, A has to be printed but some other letter is printing. Same in the case of other letters. Please help to find the mistake.
#include<stdio.h>
#include<conio.h>
#include<string.h>

int main()
{
    char m[20];
    int i;

    printf("Enter any string:");

    gets(m);

    for(i=0;i<=strlen(m);i++)
    {
        if(m[i]>=97&&m[i]<=122)
            m[i]=m[i]-26;
        else
            m[i]=m[i]+26;
    }

    printf("%s\n",m);

    return 0;
}

A:

Change the loop the following way
for(i=0; i < strlen(m); i++ )
          ^^^ 

Otherwise you overwrite the terminating zero.
And instead of magic numbers 97 and 122 it is better to use letters 'A' and 'Z'.
For example
  if ( m[i] >= 'A' && m[i] <= 'Z' )

Also it seems this statement
  m[i]=m[i]-26;

is wrong
I think you mean the following
  if ( m[i] >= 'A' && m[i] <= 'Z' )
      m[i] = m[i] + 'a' - 'A' ;
  else if ( m[i] >= 'a' && m[i] <= 'z' )
      m[i] = m[i] - 'a' + 'A' ;

Take into account that there are standard functions isupper and islower and correspondingly toupper and tolower declared in header <ctype.h>
Also function gets is not supported any more by the C Standard because it is unsafe. I advice to use fgets instead.

A:

The value will be 32 not 26.
if(m[i]>=97&&m[i]<=122)
     m[i]=m[i]-32;
else
     m[i]=m[i]+32;

Better to use for checking isupper and islower. Then change by tolower and toupper. Then you don't have to think about ASCII value.
if(isupper(m[i]))
{
     m[i]=tolower(m[i]);
}
else
{
     m[i]=toupper(m[i]);
}

