I made a program that finds the ROT 13, but theres a little thing thats messing it up for me. Its supposed to find the ROT 13 of each character but when i run it, it gives me some funky character in return
#include <stdio.h>
#include <string.h>
int rot13(int c)
{
if (c >= 'A' && c < 'N')
{
return c + 13;
}
if (c >= 'N' && c <= 'Z')
{
return c - 13;
}
if (c >= 'a' && c < 'n')
{
return c + 13;
}
if (c >= 'n' && c <= 'z')
{
return c - 13;
}
}
int main(void)
{
int c;
printf("Enter a character: ");
while((c == getchar())!= EOF)
{
char a = rot13(c);
printf("%c", a);
c++;
}
return 0;
}
Can some one help me out please