C - Write program to read first name and last name from user

Requirements

Write program to read first name and last name from user

Prompt the user for their last name and first name, and then display both names by using a single printf() function.

Hint

Set the input size for both firstname and lastname to 15.

Demo

#include <stdio.h>

int main()/* w  ww  . ja v a2s  . c  om*/
{
    char firstname[15];
    char lastname[15];

    printf("Type your first name: ");
    scanf("%s",firstname);
    printf("Type your last name: ");
    scanf("%s",lastname);
    printf("Pleased to meet you, %s %s.\n",firstname,lastname);
    return(0);
}

Result

Related Exercise