C Program to demonstrate fgets
Program
#include<stdio.h>
void main()
{
char str[100];
printf("Enter a sentence:\n");
fgets(str, 100, stdin);
printf("Entered sentence is:\n");
printf("%s", str);
}
Output
$ gcc c-program-fgets-demo.c
$ ./a.out
Enter a sentence:
welcome to oodlescoop
Entered sentence is:
welcome to oodlescoop