C > Beginners Lab Assignments
Program Implementing the rot13 algorithm
Program Implementing the rot13 algorithm #include
#define ROT 13 int main(void) { int c,e; while((c=getchar())!=EOF) { if(c >='A' && c <='Z') { if((e = c + ROT) <= 'Z') putchar(e); else { e = c - ROT; putchar(e); } } else if(c >='a' && c <='z') { if((e= c + ROT) <= 'z') putchar(e); else { e = c - ROT; putchar(e); } } else putchar(c); } return 0; }
C Codes
Beginners
C on Unix
Code Snippets
Data Structures
File Operations
Games Graphics
Gnu-Linux
Hardware
Mathematics
Miscellaneous
Small Programs
Sorting