Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. int main()
  2. {
  3. char message[100], ch;
  4. int i, key = 1;
  5.  
  6. printf("Enter a message to decrypt: ");
  7. scanf("%s",&message);
  8.  
  9. for(i = 0; message[i] != '\0'; i++){
  10. ch = message[i];
  11.  
  12. if(ch >= 'a' && ch <= 'z'){
  13. ch = ch + key;
  14.  
  15. if(ch < 'a'){
  16. ch = ch + 'z' - 'a' + 1;
  17. }
  18.  
  19. message[i] = ch;
  20. }
  21. else if(ch >= 'A' && ch <= 'Z'){
  22. ch = ch - key;
  23.  
  24. if(ch < 'A'){
  25. ch = ch + 'Z' - 'A' + 1;
  26. }
  27.  
  28. message[i] = ch;
  29. }
  30. }
  31.  
  32. printf("decodedE NAricht: %s", message);
  33.  
  34. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement