Guest User

Untitled

a guest
Mar 20th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6. int k;
  7. char ar0[20];
  8. char ar1[20];
  9. printf("Enter your key: ");
  10. scanf("%d", &k);
  11. k=(k%26);
  12. printf("Enter ciphertext.\n");
  13. scanf("%s", &ar0[0]);
  14. int n=strlen(ar0);
  15. for(int i=0; i<n; i++)
  16. {
  17. if(ar0[i]-k<=90 && ar0[i]-k>=65)
  18. ar1[i]=ar0[i]-k;
  19.  
  20. else
  21. ar1[i]=ar0[i]-k+26;
  22. }
  23.  
  24. printf("Deciphering.... \n");
  25. printf("%s \n", &ar1[0]);
  26. }
Add Comment
Please, Sign In to add comment