I think this prog solves the prob of both the original poster and Mr. Dilip. Hope this helps. If any portability prob or any other prob in the code then let me know.
#include <stdio.h>
#include <ctype.h>
int main()
{
char a[26];
int i;
printf("Enter the string: ");
fgets(a, 100, stdin); // safer than scanf()
i = 0;
while (a[i] && isalpha(a[i])) // check input is alphabet
{
if (isupper(a[i]))
a[i] = tolower(a[i]); // is this wat the OP wanted?
// no need to check bounds due to the nature of the prob stmt
if ((a[i] >= 'a') && (a[i] <= 'm'))
{
a[i] += 13;
}
// to other check req as this will always be greter than 'm' and less than equal to 'z'
else
{
a[i] -= 13;
}
a[i] = toupper(a[i]); // is this wat the OP wanted?
i++;
}
fputs(a, stdout);
getchar();
return 0;
}
See ya.
I don't accept change. I don't deserve to live.
Happiness corrupts people.
Failing to value the lives of others cheapens your own.