C - Write program to read string with fgets() function from console window

Requirements

Write program to read string with fgets() function from console window

Demo

#include <stdio.h>

int main()//w  ww  .  j a v a  2 s. c o  m
{
    char firstname[16];

    printf("What is your name? ");
    fgets(firstname,16,stdin);
    printf("Pleased to meet you, %s\n",firstname);
    return(0);
}

Result

Related Example