I want to get 2 string of character input, and then print it in one line

Viewed 23

Input:

John
US

Desired output:

" Hello My Name Is John and I Am From US ! "
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int max_limit=30;
    char name[max_limit], location[max_limit];
    fgets(name, max_limit, stdin);
    fgets(location, max_limit, stdin);
    printf("\" Hello My Name Is %s and I Am From %s ! ", name, location);
    return 0;
}

But why does the output like this?

enter image description here

0 Answers
Related