Skip to content

Instantly share code, notes, and snippets.

@Sahas-Ananth
Created March 27, 2021 18:26
Show Gist options
  • Save Sahas-Ananth/3bcc9e12c903433a01d4fbf16b3eec8d to your computer and use it in GitHub Desktop.
Save Sahas-Ananth/3bcc9e12c903433a01d4fbf16b3eec8d to your computer and use it in GitHub Desktop.
Simpler Shift Cipher encryption program using C
# 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