SHARE
TWEET

chalena yar

a guest Feb 27th, 2020 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3.  
  4. void encrypt(char text[4])
  5. {
  6. int final;
  7.     for(int i=0;i<4;i++)
  8.     {   final = text[i]+10;
  9.         printf("%c",final);
  10.     }
  11. }
  12.  
  13. void decrypt(char text[4])
  14. {
  15. int final;
  16.     for(int i=0;i<4;i++)
  17.     {   final = text[i]-10;
  18.         printf("%c",final);
  19.     }
  20. }
  21.  
  22. void main()
  23. {
  24. char text[4];
  25. int cho;
  26. printf("Enter 1 or 2:");
  27. scanf("%d",&cho);
  28. switch(cho)
  29. {
  30.     case 1:
  31.     printf("Enter text of length 4 to encrypt:");
  32.     gets(text);
  33.     encrypt(text);
  34.     break;
  35.  
  36.     case 2:
  37.     printf("Enter text of length 4 to decrypt:");
  38.     gets(text);
  39.     decrypt(text);
  40.     break;
  41. }
  42.  
  43.  
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top