fork(18) download
  1. #include <stdio.h>
  2. #include <ctype.h>
  3.  
  4. int main() {
  5.  
  6. char text[1000];
  7. int key,i;
  8. char offset;
  9. printf("Enter The text\n");
  10. scanf("%s",text);
  11. printf("Enter the key (positive to encrypt negative to decypt zero to exit)\n");
  12. scanf("%i",&key);
  13.  
  14. if(!key)
  15. return 0;
  16. for(i=0;text[i];i++)
  17. {
  18. offset='a';
  19. if(isupper(text[i]))
  20. offset='A';
  21. text[i]-=offset;
  22. text[i]=(26+text[i]+key)%26;
  23. text[i]+=offset;
  24. }
  25. printf("%s\n",text);
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 2296KB
stdin
EvefXieq
-4
stdout
Enter The text
Enter the key (positive to encrypt negative to decypt zero to exit)
ArabTeam