fgets
writes into the string that's its first argument. Since you were using the same string, the second fgets
was overwriting the string from the first one. You need two strings.
#include <stdio.h>
int main() {
char text[200], key[200];
fputs("Please, enter the text, you want to encrypt:", stdout);
printf("\n");
if(fgets(text, sizeof(text),stdin)!=NULL)
{
printf("Text to encrypt:\n""");
fputs(text, stdout);
printf("""\n");
}
fputs("Please, enter the key:", stdout);
printf("\n");
if(fgets(key, sizeof(key),stdin)!=NULL)
{
printf("Key:\n""");
fputs(key, stdout);
printf("""\n");
}
}