Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* rot13 algorithm. Very Simple and Interesting */
- #include<stdio.h>
- #define ROT 13
- void rot13(char cadena[]){
- int c,e;
- int i = 0;
- while(cadena[i] != 0){
- c = cadena[i];
- 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);
- i++;
- }
- }
- void main(){
- char input[100];
- scanf("%[^\n]%*c", input);
- rot13(input);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement