Input and Output of a string C Program demonstrates the input and output of a string in C programming language. The char
data type is used to declare a string name
of size 100.
The scanf
function is used to take input from the user and store it in the variable name
. The %s
format specifier is used to read a string value.
The printf
function is used to print the message “Your name is: %s” on the screen.
These are some of the basic input and output programs in C programming language. These programs will help you understand how to take input from the user and how to display output on the screen in C programming language.

#include <stdio.h>
int main()
{
char name[100];
printf("Enter your name: ");
scanf("%s", name);
printf("Your name is: %s", name);
return 0;
}
OUTPUT
Enter your name: John
Your name is: John
+ There are no comments
Add yours