vendredi 3 juillet 2015

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

I cant 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 . Plz 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;

}

Aucun commentaire:

Enregistrer un commentaire