C Program Code to Print String

Following C program ask to the user to enter a string like your first name, then it will display your first name after Hi,

#include<stdio.h>
#include<conio.h>
void main()
{
    clrscr();
    char str[20];
    printf("Enter your first name : ");
    scanf("%s",str);
    printf("Hi, %s",str);
    getch();
}


Run:


No comments:

Post a Comment

100 C Programs with Code and Output

Program 1: C Program To Read Two Numbers And Print The Sum Of Given Two Numbers. Program 2: C Program To Read Three Numbers And Prin...