TUCoPS :: Crypto :: rot13.c

How to ROT13 in C

#include <stdio.h>

main()   /* streamlined version of copy input to output */
{
	int c;

	while ((c =getchar()) !=EOF)
	   {
	   if( c>= 97 && c <= 109 )
	      c=c+13;
	   else if( c >= 110 && c <= 122 )
	      c=c-13;
	      else if( c >= 65 && c <= 77 )
		 c=c+13;
		 else if( c >= 78 && c <= 90 )
		    c=c-13;
		putchar(c);
		}
}

TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2024 AOH