C Program To Print Your Own Name

  C Program Examples

C Program to print your own Name

 The following C program displays your own name


Write a C program to print your own Name
// C program to demonstrate printing of
// our own name using scanf()
#include <stdio.h>
  
int main()
{
    char name[20];
    printf("Enter name: ");
  
    // user input will be taken here
    scanf("%s", name);
    printf("Your name is %s.", name);
    return 0;
}


In this example, we use scanf() to accept the name as input from the user and then print it.

Post a Comment

Previous Post Next Post