/* *a program using the function getchar() that inputs a string of *characters. It then encrypts the string using the following code: 'b' becomes *'a', 'c' becomes 'b', ..., 'a' becomes 'z', 'B' becomes 'A', 'C' becomes 'B', *..., 'A' becomes 'Z' *author:rahule@cse.iitk.ac.in */ #include int main() { int c; printf("Enter the string\n"); while((c=getchar())!='\n') //reads charecters till the newline character { if(((c>65)&&(c<91))||((c>97)&&(c<123))) //checks whether the entered character is a valid alphebet putchar(c-1); else if((c==65)||(c==97)) //if character is "a" or "A",prints "z" and "Z" respectively. putchar(c+25); } printf("\n"); }