Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void encrypt(char text[4])
- {
- int final;
- for(int i=0;i<4;i++)
- { final = text[i]+10;
- printf("%c",final);
- }
- }
- void decrypt(char text[4])
- {
- int final;
- for(int i=0;i<4;i++)
- { final = text[i]-10;
- printf("%c",final);
- }
- }
- void main()
- {
- char text[4];
- int cho;
- printf("Enter 1 or 2:");
- scanf("%d",&cho);
- switch(cho)
- {
- case 1:
- printf("Enter text of length 4 to encrypt:");
- gets(text);
- encrypt(text);
- break;
- case 2:
- printf("Enter text of length 4 to decrypt:");
- gets(text);
- decrypt(text);
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement