Created
March 27, 2021 18:26
-
-
Save Sahas-Ananth/3bcc9e12c903433a01d4fbf16b3eec8d to your computer and use it in GitHub Desktop.
Simpler Shift Cipher encryption program using C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include <stdio.h> | |
# include <stdlib.h> | |
# include <string.h> | |
int main () { | |
char word[100]; | |
int OFFSET = 1; | |
printf("Enter a string: "); | |
scanf("%s", word); | |
printf("Enter Offset: "); | |
scanf("%d", &OFFSET); | |
printf("Encoded Word: "); | |
for (int i = 0; i < strlen(word); i++) { | |
printf("%c", word[i] + OFFSET) ; | |
} | |
printf("\nDecoded Word: "); | |
for (int i = 0; i < strlen(word); i++) { | |
printf("%c", word[i]); | |
} | |
printf("\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment