The last printf instruction doesn't work with key = 3. I can't understand why, can someone help me? Thanks.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char string[100];
int key;
int jump;
printf("Enter the text: ");
fgets(string, 100, stdin);
printf("Enter crypto key: ");
scanf("%d", &key);
for (int i = 0; i < strlen(string); i++)
{
jump = 0;
if (string[i] + key > 126)
{
jump = 95;
}
string[i] = string[i] + key - jump;
}
printf("The crypto text in key %d is: %s", key, string);
return 0;
}