C Language program to scan name of user and say hello with name

Views: 138   

Following program shows you how to scan name of user and say hello with name
In this program we get name from user using scanf method and prints hello with that name using printf

#include <stdio.h>

int main(void) {
    char name[50];
    printf("Please enter a name:");
    scanf("%s", name);
    printf("Hello %s", name);
}

Output:

Please enter a name: 
 Tom
Hello Tom
On By