#include int main() { int shift = 0;char choice; printf("Enter the shift parameter ( < 26 )"); scanf("%d",&shift); //while((ch)) printf("Enter 'e' for encrypt or 'd' for decrypt :"); scanf(" %c",&choice); // note the space before %c printf("shift : %d choice : %c \n",shift,choice); char ch; while( (ch = getchar()) != '\n' ); ch = getchar(); //int isNegative = 0,gotDecimal = 0;int integerPart = 0,floatPart = 0,div1 = 1,div =1; while( (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ) { if(choice == 'e') { if(ch >= 'a' && ch<='z') { int offset = ( (ch - 'a')+shift )% 26; putchar('a' + offset); } if(ch >= 'A' && ch<='Z') { int offset = ( (ch - 'A')+shift )% 26; putchar('A' + offset); } } else if(choice == 'd') { if(ch >= 'a' && ch<='z') { int offset = ( (ch - 'a')-shift )% 26; if(offset < 0) offset = offset + 26; putchar('a' + offset); } if(ch >= 'A' && ch<='Z') { int offset = ( (ch - 'A')-shift )% 26; putchar('A' + offset); } } ch = getchar(); } printf("\n"); return 0; }