Starting Vocational Training From 1-May-2024 Get Detail
Write a program in C to input a string and print it.
Test Data :
Input the string : Welcome, w3resource
Expected Output :
The string you entered is : Welcome, w3resource
#include <stdio.h>
#include <stdlib.h>
void main()
{
char str[50];
printf("
Accept a string from keyboard :
");
printf("-----------------------------------
");
printf("Input the string : ");
fgets(str, sizeof str, stdin);
printf("The string you entered is : %s
", str);
}